Error in installing JPype1 in Python 3.7 on Mac OS 10.14.2

此生再无相见时 提交于 2021-02-18 07:55:47

问题


I am getting error while installing JPype1 in my system. I am using Python 3.7. JPype1 is required as dependency for Jaydebeapi.

pip install Jpype1

Following are the error message:


    Collecting jpype1
    Using cached 
    https://files.pythonhosted.org/packages/c4/4b/60a3e63d51714d4d7ef1b1efdf84315d118a0a80a5b085bb52a7e2428cdc/JPype1-0.6.3.tar.gz
    Building wheels for collected packages: jpype1
      Running setup.py bdist_wheel for jpype1 ... error
      Complete output from command /Users/citius/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-wheel-swsvni4l --python-tag cp36:
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.7-x86_64-3.6
      creating build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jcollection.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_classpath.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_pykeywords.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jproxy.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_gui.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_darwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/nio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_cygwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_properties.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_refdaemon.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jboxed.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/JClassUtil.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jvmfinder.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/imports.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_core.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_linux.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jarray.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jobject.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jclass.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_windows.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jwrapper.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jexception.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/reflect.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      copying jpype/_jpackage.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
      creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt
      copying jpype/awt/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt
      creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event
      copying jpype/awt/event/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event
      copying jpype/awt/event/WindowAdapter.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event
      creating build/lib.macosx-10.7-x86_64-3.6/jpypex
      copying jpypex/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex
      creating build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
      copying jpypex/swing/AbstractAction.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
      copying jpypex/swing/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
      copying jpypex/swing/pyutils.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
      running build_ext
      /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access
        FeatureNotice)
      building '_jpype' extension
      creating build/temp.macosx-10.7-x86_64-3.6
      creating build/temp.macosx-10.7-x86_64-3.6/native
      creating build/temp.macosx-10.7-x86_64-3.6/native/python
      creating build/temp.macosx-10.7-x86_64-3.6/native/common
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/citius/anaconda3/include -arch x86_64 -I/Users/citius/anaconda3/include -arch x86_64 -DMACOSX=1 -DHAVE_NUMPY=1 -Inative/common/include -Inative/python/include -Inative/jni_include -I/Users/citius/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/Users/citius/anaconda3/include/python3.6m -c native/python/jpype_python.cpp -o build/temp.macosx-10.7-x86_64-3.6/native/python/jpype_python.o -ggdb
      In file included from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/syslimits.h:7:0,
                       from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:34,
                       from /Users/citius/anaconda3/include/python3.6m/Python.h:11,
                       from native/python/include/jpype_python.h:23,
                       from native/python/jpype_python.cpp:19:
      /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
       #include_next   /* recurse down to the real one */
                                                                   ^
      compilation terminated.
      error: command 'gcc' failed with exit status 1

      ----------------------------------------
      Failed building wheel for jpype1
      Running setup.py clean for jpype1
    Failed to build jpype1
    Installing collected packages: jpype1
      Running setup.py install for jpype1 ... error
        Complete output from command /Users/citius/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-record-3pg5yd08/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib.macosx-10.7-x86_64-3.6
        creating build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jcollection.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_classpath.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_pykeywords.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jproxy.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_gui.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_darwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/nio.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_cygwin.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_properties.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_refdaemon.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jboxed.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/JClassUtil.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jvmfinder.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/imports.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_core.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_linux.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jarray.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jobject.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jclass.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_windows.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jwrapper.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jexception.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/reflect.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        copying jpype/_jpackage.py -> build/lib.macosx-10.7-x86_64-3.6/jpype
        creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt
        copying jpype/awt/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt
        creating build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event
        copying jpype/awt/event/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event
        copying jpype/awt/event/WindowAdapter.py -> build/lib.macosx-10.7-x86_64-3.6/jpype/awt/event
        creating build/lib.macosx-10.7-x86_64-3.6/jpypex
        copying jpypex/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex
        creating build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
        copying jpypex/swing/AbstractAction.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
        copying jpypex/swing/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
        copying jpypex/swing/pyutils.py -> build/lib.macosx-10.7-x86_64-3.6/jpypex/swing
        running build_ext
        /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access
          FeatureNotice)
        building '_jpype' extension
        creating build/temp.macosx-10.7-x86_64-3.6
        creating build/temp.macosx-10.7-x86_64-3.6/native
        creating build/temp.macosx-10.7-x86_64-3.6/native/python
        creating build/temp.macosx-10.7-x86_64-3.6/native/common
        gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/citius/anaconda3/include -arch x86_64 -I/Users/citius/anaconda3/include -arch x86_64 -DMACOSX=1 -DHAVE_NUMPY=1 -Inative/common/include -Inative/python/include -Inative/jni_include -I/Users/citius/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/Users/citius/anaconda3/include/python3.6m -c native/python/jpype_python.cpp -o build/temp.macosx-10.7-x86_64-3.6/native/python/jpype_python.o -ggdb
        In file included from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/syslimits.h:7:0,
                         from /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:34,
                         from /Users/citius/anaconda3/include/python3.6m/Python.h:11,
                         from native/python/include/jpype_python.h:23,
                         from native/python/jpype_python.cpp:19:
        /Users/citius/anaconda3/lib/gcc/x86_64-apple-darwin11.4.2/4.8.5/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
         #include_next   /* recurse down to the real one */
                                                                     ^
        compilation terminated.
        error: command 'gcc' failed with exit status 1

        ----------------------------------------
    Command "/Users/citius/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-record-3pg5yd08/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/kw/ykkdj1vn7qj_2hms02xmtz6h0000gn/T/pip-install-1rreficl/jpype1/


回答1:


First install gcc using conda

conda install gcc

Then use binary installation for jpype1. Install it from the conda-forge software channel.

conda install -c conda-forge jpype1

It worked for me.

It also works for Python2.7




回答2:


For Amazon Linux or other RedHat-based:

dnf install redhat-rpm-config gcc-c++ python3-devel unixODBC-devel



来源:https://stackoverflow.com/questions/54016317/error-in-installing-jpype1-in-python-3-7-on-mac-os-10-14-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!