Issue running the exe: No Module named '_jpype'

42 views
Skip to first unread message

Robin Gehring

unread,
May 17, 2024, 6:07:48 AMMay 17
to PyInstaller
Hi,

I want to create an .exe from my python scripts. I added alle the imports but if I start the exe it always throws an error: "No Module named '_jpype' "
So in jpype there is a file named _init_.py and in line 18 it says "import _jpype"
Then I tried to find the location of _jpype and it directs me to this file:
_jpype.cp311-win_amd64.pyd

How can I add this file to my pyinstaller?

I tried to add it with --add-binary but this does not work.

Btw, I use auto-py-to-exe

Many Thanks and best regards!

bwoodsend

unread,
May 17, 2024, 7:09:29 AMMay 17
to PyInstaller

--hiddenimport=_jpype is the flag for missing modules.

Message has been deleted

Robin Gehring

unread,
May 17, 2024, 9:13:43 AMMay 17
to PyInstaller
I did this, but it still gives me the same error

Hidden import does not work:
15971242 ERROR: Hidden import '_jpype' not found

bwoodsend

unread,
May 19, 2024, 3:34:17 PMMay 19
to PyInstaller

I’m not seeing any issues with just an import jpype (which includes loading the _jpype module).

>python -VV Python 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)] >python -m venv env >.\env\Scripts\activate.bat (env) >pip install jpype1 pyinstaller (env) C:\tmp\jpype-test>pip freeze altgraph==0.17.4 JPype1==1.5.0 packaging==24.0 pefile==2023.2.7 pyinstaller==6.6.0 pyinstaller-hooks-contrib==2024.6 pywin32-ctypes==0.2.2 (env) >echo import jpype; print(jpype._jpype) > test.py (env) >pyinstaller test.py (env) >.\dist\test\test.exe <module '_jpype' from '.\\dist\\test\\_internal\\_jpype.cp311-win_amd64.pyd'>
Reply all
Reply to author
Forward
0 new messages