Java – Pip install error in Mac OS(error: command ‘/usr/bin/clang’ failed with exit status 1)

java, jpype, macos, pip, python

I want to install JPype1 via pip3 installation on Mac OS.

$ pip3 install JPype1 

However, the following error happens again and again.

Collecting JPype1 Using cached https://files.pythonhosted.org/packages/c4/4b/60a3e63d51714d4d7ef1b1efdf84315d118a0a80a5b085bb52a7e2428cdc/JPype1-0.6.3.tar.gzInstalling collected packages: JPype1Running setup.py install for JPype1 ... errorComplete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/_t/j4yyfrs972scc4kbnzmqw_d80000gn/T/pip-install-ikitwbg0/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/_t/j4yyfrs972scc4kbnzmqw_d80000gn/T/pip-record-el7dtlip/install-record.txt --single-version-externally-managed --compile:running installrunning buildrunning build_pycreating buildcreating build/lib.macosx-10.6-intel-3.6creating build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jcollection.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_classpath.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jio.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_pykeywords.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jproxy.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_gui.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_darwin.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/nio.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_cygwin.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_properties.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/__init__.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_refdaemon.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jboxed.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/JClassUtil.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jvmfinder.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/imports.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_core.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_linux.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jarray.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jobject.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jclass.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_windows.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jwrapper.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jexception.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/reflect.py -> build/lib.macosx-10.6-intel-3.6/jpypecopying jpype/_jpackage.py -> build/lib.macosx-10.6-intel-3.6/jpypecreating build/lib.macosx-10.6-intel-3.6/jpype/awtcopying jpype/awt/__init__.py -> build/lib.macosx-10.6-intel-3.6/jpype/awtcreating build/lib.macosx-10.6-intel-3.6/jpype/awt/eventcopying jpype/awt/event/__init__.py -> build/lib.macosx-10.6-intel-3.6/jpype/awt/eventcopying jpype/awt/event/WindowAdapter.py -> build/lib.macosx-10.6-intel-3.6/jpype/awt/eventcreating build/lib.macosx-10.6-intel-3.6/jpypexcopying jpypex/__init__.py -> build/lib.macosx-10.6-intel-3.6/jpypexcreating build/lib.macosx-10.6-intel-3.6/jpypex/swingcopying jpypex/swing/AbstractAction.py -> build/lib.macosx-10.6-intel-3.6/jpypex/swingcopying jpypex/swing/__init__.py -> build/lib.macosx-10.6-intel-3.6/jpypex/swingcopying jpypex/swing/pyutils.py -> build/lib.macosx-10.6-intel-3.6/jpypex/swingrunning build_ext/private/var/folders/_t/j4yyfrs972scc4kbnzmqw_d80000gn/T/pip-install-ikitwbg0/JPype1/setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access  FeatureNotice)building '_jpype' extensioncreating build/temp.macosx-10.6-intel-3.6creating build/temp.macosx-10.6-intel-3.6/nativecreating build/temp.macosx-10.6-intel-3.6/native/pythoncreating build/temp.macosx-10.6-intel-3.6/native/common/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch i386 -arch x86_64 -g -DMACOSX=1 -DHAVE_NUMPY=1 -Inative/common/include -Inative/python/include -Inative/jni_include -I/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c native/python/jpype_python.cpp -o build/temp.macosx-10.6-intel-3.6/native/python/jpype_python.o -ggdbwarning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]In file included from native/python/jpype_python.cpp:19:In file included from native/python/include/jpype_python.h:24:native/common/include/jpype.h:107:10: fatal error: 'map' file not found#include <map>         ^~~~~1 warning and 1 error generated.error: command '/usr/bin/clang' failed with exit status 1Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/_t/j4yyfrs972scc4kbnzmqw_d80000gn/T/pip-install-m85m9kdb/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/_t/j4yyfrs972scc4kbnzmqw_d80000gn/T/pip-record-yzt5gaag/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_t/j4yyfrs972scc4kbnzmqw_d80000gn/T/pip-install-m85m9kdb/JPype1/

Other question-answers say that Xcode is required to solve this. However, even after I installed XCode with this code, it doesn't solve the error.

 $ xcode-select --install

(and also with Appstore download)

Can anyone help me?

Best Solution

For macOS Mojave, play with export CFLAGS='-stdlib=libc++' before calling python setup.py install