Skip to content

Error installing python-javabridge JDK-18, macos #206

Description

@adam-zaidi

Hello,

I am trying to install python-javabridge for macos Catalina, and when I run

pip3 install python-javabridge

I get this error.

Building wheel for javabridge (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /opt/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/setup.py'"'"'; file='"'"'/private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-wheel-s9ot8rdb
cwd: /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/
Complete output (44 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.1-arm64-3.9
creating build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/_version.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/jutil.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/locate.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/init.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/wrappers.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/noseplugin.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
creating build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/init.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_cpython.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_javabridge.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_jutil.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_wrappers.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
creating build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/rhino-1.7R4.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/runnablequeue.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/cpython.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/test.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
running build_ext
javac /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/runnablequeue/RunnableQueue.java
javac /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/test/RealRect.java
javac /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/CPython.java /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/CPythonInvocationHandler.java
Note: /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/CPythonInvocationHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
building 'javabridge._javabridge' extension
creating build/temp.macosx-11.1-arm64-3.9
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/miniconda3/include -arch arm64 -I/opt/miniconda3/include -fPIC -O2 -isystem /opt/miniconda3/include -arch arm64 -I/System/Library/Frameworks/JavaVM.Framework/Headers -I/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include -I/opt/miniconda3/include/python3.9 -c _javabridge.c -o build/temp.macosx-11.1-arm64-3.9/_javabridge.o
In file included from _javabridge.c:598:
In file included from /opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
In file included from /opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960:
/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with "
^
_javabridge.c:600:10: fatal error: 'jni.h' file not found
#include "jni.h"
^~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

ERROR: Failed building wheel for javabridge
Running setup.py clean for javabridge
Failed to build javabridge
Installing collected packages: javabridge
Running setup.py install for javabridge ... error
ERROR: Command errored out with exit status 1:
command: /opt/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/setup.py'"'"'; file='"'"'/private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-record-ed75clbn/install-record.txt --single-version-externally-managed --compile --install-headers /opt/miniconda3/include/python3.9/javabridge
cwd: /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/
Complete output (46 lines):
running install
/opt/miniconda3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-11.1-arm64-3.9
creating build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/_version.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/jutil.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/locate.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/init.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/wrappers.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
copying javabridge/noseplugin.py -> build/lib.macosx-11.1-arm64-3.9/javabridge
creating build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/init.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_cpython.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_javabridge.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_jutil.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
copying javabridge/tests/test_wrappers.py -> build/lib.macosx-11.1-arm64-3.9/javabridge/tests
creating build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/rhino-1.7R4.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/runnablequeue.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/cpython.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
copying javabridge/jars/test.jar -> build/lib.macosx-11.1-arm64-3.9/javabridge/jars
running build_ext
javac /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/runnablequeue/RunnableQueue.java
javac /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/test/RealRect.java
javac /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/CPython.java /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/CPythonInvocationHandler.java
Note: /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/java/org/cellprofiler/javabridge/CPythonInvocationHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
building 'javabridge._javabridge' extension
creating build/temp.macosx-11.1-arm64-3.9
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/miniconda3/include -arch arm64 -I/opt/miniconda3/include -fPIC -O2 -isystem /opt/miniconda3/include -arch arm64 -I/System/Library/Frameworks/JavaVM.Framework/Headers -I/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include -I/opt/miniconda3/include/python3.9 -c _javabridge.c -o build/temp.macosx-11.1-arm64-3.9/_javabridge.o
In file included from _javabridge.c:598:
In file included from /opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
In file included from /opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960:
/opt/miniconda3/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with "
^
_javabridge.c:600:10: fatal error: 'jni.h' file not found
#include "jni.h"
^~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/miniconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/setup.py'"'"'; file='"'"'/private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-install-djhywiy3/javabridge_c21c8c89d80f43fb80214b3f856e2be0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/mf/zszwkwsd6p121df2kwsxf7hr0000gn/T/pip-record-ed75clbn/install-record.txt --single-version-externally-managed --compile --install-headers /opt/miniconda3/include/python3.9/javabridge Check the logs for full command output.

I've looked through the other issues about missing the jni.h in include, and I've tried moving JAVA_HOME but nothing seems to work. Any help would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions