Open larandvit opened 6 years ago
Hi Vitaly, It looks like you are using a 32-bit version of Python. I'm not sure if I can replicate that environment any longer (but I'll try tonight). Is it possible for you to use a 64-bit toolchain? I'm not sure if that will solve the problem, though.
--Lee
Thank you, Lee, for quick response.
32 bit Python installation is default one for Windows. I'm not sure if there is an option to install 64 bit one. I had more issues before but after matching 32 bit for all related tools (tool chain), I almost could build it.
Vitaly.
Hi Lee,
I've managed to compile javabridge as 32 bit but when I run it it generates run-time.
I've changed the code in org_cellprofiler_javabridge_CPython.c
original code: jint JNI_OnLoad(JavaVM *vm, void *reserved)
new code: JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
Also, I've found another issue with access to Windows registry. The code below produces run-time in locate.py
kjava = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, java_key_path)
kjdk = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, jdk_key_path)
I suspect the reason is that even I run the build in command line with option as an administrator, the building process doesn't have access to the Windows registry.
I've just run SET commands for JAVA_HOME and JAVA_SDK in command line to bypass registry call.
The successful message after installing the build is
Installed c:\program files (x86)\python36-32\lib\site-packages\javabridge-1.0.15-py3.6-win32.egg Processing dependencies for javabridge==1.0.15 Searching for numpy==1.13.3 Best match: numpy 1.13.3 Adding numpy 1.13.3 to easy-install.pth file
Using c:\program files (x86)\python36-32\lib\site-packages Finished processing dependencies for javabridge==1.0.15
The code what I run to test javabridge
import os
import javabridge
javabridge.start_vm(run_headless=True)
try:
print(javabridge.run_script('java.lang.String.format("Hello, %s!", greetee);',
dict(greetee='world')))
finally:
javabridge.kill_vm()
The error message is
_Traceback (most recent call last):
File "...\test.py", line 2, in
My next step is to try it with Python 64 bit.
Can you provide with your thoughts or suggestions?
Vitaly.
Regarding the registry errors, if I remember correctly, there are separate keys that allow access to the 32-bit registry values (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724072(v=vs.85).aspx for a discussion). It may be that the values are in the 64-bit registry and not the 32-bit and that "KEY_WOW64_64KEY" needs to be at the base of the registry key path. Again, I'd have to test to see if this is true. The work-around is to set JAVA_HOME and JAVA_SDK to bypass - you've done the right thing there.
The next error message gives me a good clue as to what's going wrong. C:\Program Files (x86)\Python36-32\lib\site-packages\javabridge-1.0.15-py3.6-win32.egg
is the path to a zip file containing the Python files needed to run Javabridge. _javabridge.dll
is unlikely to be in there and would be inaccessible if it were. The setup script should be marked with an indication that it's not safe to make a zipfile egg and that's missing which is my fault.
Could you patch setup.py for me here: https://github.com/LeeKamentsky/python-javabridge/blob/master/setup.py#L394 passing the argument, zip_safe=False
and try again? If that works, I'd really appreciate you forking the project and submitting a pull request with both your changes to org_cellprofiler_javabridge_CPython.c and to setup.py. I can modify them myself if that's difficult for you, but a little easier for me to get a patch from you than to do it myself.
Hi Lee,
As per your instruction, I've added code below to setup.py file. It's still generating the same error message.
cmdclass={'build_ext': build_ext},
zip_safe=False)
The message after successful build is
removing 'build\bdist.win32\egg' (and everything under it) Processing javabridge-1.0.15-py3.6-win32.egg creating c:\program files (x86)\python36-32\lib\site-packages\javabridge-1.0.15-py3.6-win32.egg Extracting javabridge-1.0.15-py3.6-win32.egg to c:\program files (x86)\python36-32\lib\site-packages Adding javabridge 1.0.15 to easy-install.pth file
Installed c:\program files (x86)\python36-32\lib\site-packages\javabridge-1.0.15-py3.6-win32.egg Processing dependencies for javabridge==1.0.15 Searching for numpy==1.13.3 Best match: numpy 1.13.3 Adding numpy 1.13.3 to easy-install.pth file
Using c:\program files (x86)\python36-32\lib\site-packages Finished processing dependencies for javabridge==1.0.15
I can see extracted javabridge-1.0.15-py3.6-win32.egg file in C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg folder. There are two sub folders: EGG-INFO and javabridge.
What would you suggest as next steps?
Thanks.
Vitaly.
I would try the 64-bit version unless you want to continue debugging.
In the javabridge folder, is there a file named _javabridge.dll? You might try running the 32-bit dependency walker on it to see if it's a valid .dll and to check its dependencies: http://www.dependencywalker.com/
Hi Lee,
I don't see _javabridge.dll file. Please review a list of file installed. I can provide with zipped file as well.
I would like to continue the debugging of 32 bit installation. I'm confident we can make it work,
Directory of C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg
01/11/2017 08:29 PM <DIR> .
01/11/2017 08:29 PM <DIR> ..
01/11/2017 08:29 PM <DIR> EGG-INFO
01/11/2017 08:34 PM <DIR> javabridge
0 File(s) 0 bytes
Directory of C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg\EGG-INFO
01/11/2017 08:29 PM <DIR> .
01/11/2017 08:29 PM <DIR> ..
01/11/2017 08:29 PM 1 dependency_links.txt
01/11/2017 08:29 PM 73 entry_points.txt
01/11/2017 08:29 PM 73 native_libs.txt
01/11/2017 08:29 PM 2 not-zip-safe
01/11/2017 08:29 PM 885 PKG-INFO
01/11/2017 08:29 PM 6 requires.txt
01/11/2017 08:29 PM 1,295 SOURCES.txt
01/11/2017 08:29 PM 11 top_level.txt
8 File(s) 2,346 bytes
Directory of C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg\javabridge
01/11/2017 08:34 PM <DIR> .
01/11/2017 08:34 PM <DIR> ..
01/11/2017 08:32 PM <DIR> jars
01/11/2017 08:29 PM 80,230 jutil.py
01/11/2017 08:29 PM 9,284 locate.py
01/11/2017 08:29 PM 3,496 noseplugin.py
01/11/2017 08:29 PM <DIR> tests
01/11/2017 08:29 PM 20,193 wrappers.py
01/11/2017 08:29 PM 232,448 _javabridge.cp36-win32.pyd
01/11/2017 08:29 PM 306 _javabridge.py
01/11/2017 08:29 PM 23 _version.py
01/11/2017 08:29 PM 2,984 __init__.py
01/11/2017 08:29 PM <DIR> __pycache__
8 File(s) 348,964 bytes
Directory of C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg\javabridge\jars
01/11/2017 08:32 PM <DIR> .
01/11/2017 08:32 PM <DIR> ..
01/11/2017 08:29 PM 4,112 cpython.jar
01/11/2017 08:29 PM 14,336 java2cpython.dll
01/11/2017 08:29 PM 1,134,765 rhino-1.7R4.jar
01/11/2017 08:29 PM 1,830 runnablequeue.jar
01/11/2017 08:29 PM 989 test.jar
5 File(s) 1,156,032 bytes
Directory of C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg\javabridge\tests
01/11/2017 08:29 PM <DIR> .
01/11/2017 08:29 PM <DIR> ..
01/11/2017 08:29 PM 2,516 test_cpython.py
01/11/2017 08:29 PM 22,400 test_javabridge.py
01/11/2017 08:29 PM 28,692 test_jutil.py
01/11/2017 08:29 PM 5,984 test_wrappers.py
01/11/2017 08:29 PM 0 __init__.py
01/11/2017 08:29 PM <DIR> __pycache__
5 File(s) 59,592 bytes
Directory of C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg\javabridge\tests\__pycache__
01/11/2017 08:29 PM <DIR> .
01/11/2017 08:29 PM <DIR> ..
01/11/2017 08:29 PM 2,889 test_cpython.cpython-36.pyc
01/11/2017 08:29 PM 23,492 test_javabridge.cpython-36.pyc
01/11/2017 08:29 PM 31,832 test_jutil.cpython-36.pyc
01/11/2017 08:29 PM 9,268 test_wrappers.cpython-36.pyc
01/11/2017 08:29 PM 198 __init__.cpython-36.pyc
5 File(s) 67,679 bytes
Directory of C:\Program Files (x86)\Python36-32\Lib\site-packages\javabridge-1.0.15-py3.6-win32.egg\javabridge\__pycache__
01/11/2017 08:29 PM <DIR> .
01/11/2017 08:29 PM <DIR> ..
01/11/2017 08:29 PM 70,685 jutil.cpython-36.pyc
01/11/2017 08:29 PM 6,472 locate.cpython-36.pyc
01/11/2017 08:29 PM 3,896 noseplugin.cpython-36.pyc
01/11/2017 08:29 PM 18,310 wrappers.cpython-36.pyc
01/11/2017 08:29 PM 503 _javabridge.cpython-36.pyc
01/11/2017 08:29 PM 214 _version.cpython-36.pyc
01/11/2017 08:29 PM 2,905 __init__.cpython-36.pyc
7 File(s) 102,985 bytes
Total Files Listed:
38 File(s) 1,737,598 bytes
20 Dir(s) 53,061,943,296 bytes free
OK - I'm sorry, it was _javabridge.pyd I was looking for. I see you've got _javabridge.cp36-win32.pyd. I think I might have to try and replicate this on my Windows machine this weekend. You might try running the dependency walker on _javabridge.cp36-win32.pyd and maybe that will provide some clue.
Hi Lee,
I tried 64 bit Python and javabridge. It works just perfect as expected: pip install javabridge. I'll try Linux as well.
Thanks.
Vitaly.
Hi Lee,
javabridge works on CentOS 7.4 with Python 3.4. I spent some time to figure out all dependencies. • sudo yum install epel-release • sudo yum install python34 • sudo yum install python34-setuptools • sudo easy_install-3.4 pip • sudo yum install python34-devel • sudo yum install java-1.8.0-openjdk-devel • sudo pip install numpy • sudo pip install javabridge
Thanks.
Vitaly.
I believe that both these pull requests relate to this issue: https://github.com/LeeKamentsky/python-javabridge/pull/133 (merged, helps to find Java 1.8+), https://github.com/LeeKamentsky/python-javabridge/pull/135 (not merged, helps with Windows x86/32-bit installs)
Hello,
I'm trying to install javabridge on Windows and it fails.
Environment Windows 7 jdk1.8.0_131 (32 bit) Visual Studio 2015 C++ compiler Python 3.6.3 (32 bit)
Try to install it in different ways 1)pip install javabridge 2)python setup.py install 3) set MSSdk=1 set DISTUTILS_USE_SDK=1 pip install javabridge
I receive the same result
building java2cpython library creating build\temp.win32-3.6\Release\java
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-Ic:\program files (x86)\python36-32\Include" -Ijava "-IC:\Program Files (x86)\Java\jdk1.8.0_131\include" "-IC:\Program Files (x86)\Java\jdk1.8.0_131\include\win32" "-Ic:\program files (x86)\python36-32\include" "-Ic:\program files (x86)\python36-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcjava/org_cellprofiler_javabridge_CPython.c /Fobuild\temp.win32-3.6\Release\java/org_cellprofiler_javabridge_CPython.obj
The last two lines tell the reason.
Can you please fix it or suggest a workaround?
Vitaly.