I have been using jpype to integrate with some java code using python lately and have been having no real issues. I am now attempting to set up my stack on a new system and am running into difficulties.
I am running 32-bit Python 3.6.5 and 32-bit oracle Java 1.8 update 171. Python and jpype have been installed using conda (conda create -n venv -c conda-forge python jpype1 arrow
), and
jpype.getDefaultJVMPath()
returns the expected path (C:\Program Files (x86)\Java\jre1.8.0_171\bin\client\jvm.dll
), however an exception is raised stating that it could not find the module. The output from the python console below.
Python 3.6.5 | packaged by conda-forge | (default, Apr 6 2018, 16:13:16) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import jpype
>>> import os
>>> jpype.__version__
'0.6.3'
>>> jvm_path=jpype.getDefaultJVMPath()
>>> jvm_path
'C:\\Program Files (x86)\\Java\\jre1.8.0_171\\bin\\client\\jvm.dll'
>>> os.path.exists(jvm_path)
True
>>> jpype.startJVM(jvm_path)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\conda\conda\envs\venv\lib\site-packages\jpype\_core.py", line 70, in startJVM
_jpype.startup(jvm, tuple(args), True)
RuntimeError: Unable to load DLL [C:\Program Files (x86)\Java\jre1.8.0_171\bin\client\jvm.dll], error = The specified module could not be found.
at native\common\include\jp_platform_win32.h:58
>>>
What am I missing and/or doing wrong here?
In digging thru differences between the3 windows systems that I have been working on (2 working and this one that was not working) I found that the Microsoft Visual C++ 2010 Redistributable Package (x86) had been installed on the previous 2 systems but not the one exhibiting this behavior.
Installing the C++ redistributable immediately corrected the issue.