Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error importing jpype module

Tags:

python

jpype

Could someone please advise in resolving the below error? Python 3.5.1 / jpype1-py3 0.5.5.2 installed on 64 bit windows machine. I've cannot find _jtype anywhere in Lib or Lib/site-packages.

Regards Steve

>>> import jpype
Traceback (most recent call last):
  File "", line 1, in 
    import jpype
  File "C:\Program Files\Python35\lib\site-packages\jpype\__init__.py", line 18, in 
    from ._jpackage import *
  File "C:\Program Files\Python35\lib\site-packages\jpype\_jpackage.py", line 18, in 
    import _jpype
ImportError: DLL load failed: The specified module could not be found.
like image 226
swsupp Avatar asked Aug 14 '26 00:08

swsupp


1 Answers

According to this thread, you need to make sure setup.py is pointing to the correct jvm directory. looking into setup.py of you can see that it searches for JAVA_HOME system variable:

java_home = os.getenv('JAVA_HOME', '')
found_jni = False
if os.path.exists(java_home):
    platform_specific['include_dirs'] += [os.path.join(java_home, 'include')]
# The code goes on

It may be that you didn't configure this system variable.

Since you installed via pip, and probalby didn't touch te setup.py file, I recommend you to do the following:
1-) Uninstall the package, and delete the build directories
2-) Set JAVA_HOME variable following this
3-) Download JPype manually from github and install it using python setup.py install

Good luck, tell me if it works

like image 122
Tales Pádua Avatar answered Aug 16 '26 14:08

Tales Pádua