Posted at

python mojimoji のインストールがコケる

macos mojaveで

 pip3 install mojimoji

をすると下記でコケた。

pythonは

 brew install python3

でインストールしている。

Collecting mojimoji

Using cached https://files.pythonhosted.org/packages/6e/dd/b2fde54ecfd7f66e5a39ca0fd6245480af62e0d91dbe9d6a5d4551196e67/mojimoji-0.0.8.tar.gz

Building wheels for collected packages: mojimoji

Running setup.py bdist_wheel for mojimoji ... error

Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/y3/pbwjdvvd6g3f5ykh8qczlyd00000gn/T/pip-install-0fq2nxsl/mojimoji/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/y3/pbwjdvvd6g3f5ykh8qczlyd00000gn/T/pip-wheel-w0ld4uog --python-tag cp37:

running bdist_wheel

running build

running build_ext

building 'mojimoji' extension

creating build

creating build/temp.macosx-10.14-x86_64-3.7

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -stdlib=libstdc++ -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c mojimoji.cpp -o build/temp.macosx-10.14-x86_64-3.7/mojimoji.o

warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

mojimoji.cpp:580:10: fatal error: 'tr1/unordered_map' file not found

#include

^~~~~~~~~~~~~~~~~~~

1 warning and 1 error generated.

error: command 'clang' failed with exit status 1


Failed building wheel for mojimoji

Running setup.py clean for mojimoji

Failed to build mojimoji

Installing collected packages: mojimoji

Running setup.py install for mojimoji ... error

Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/y3/pbwjdvvd6g3f5ykh8qczlyd00000gn/T/pip-install-0fq2nxsl/mojimoji/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/y3/pbwjdvvd6g3f5ykh8qczlyd00000gn/T/pip-record-6cg8gdn2/install-record.txt --single-version-externally-managed --compile:

running install

running build

running build_ext

building 'mojimoji' extension

creating build

creating build/temp.macosx-10.14-x86_64-3.7

clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -stdlib=libstdc++ -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c mojimoji.cpp -o build/temp.macosx-10.14-x86_64-3.7/mojimoji.o

warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]

mojimoji.cpp:580:10: fatal error: 'tr1/unordered_map' file not found

#include

^~~~~~~~~~~~~~~~~~~

1 warning and 1 error generated.

error: command 'clang' failed with exit status 1


Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/y3/pbwjdvvd6g3f5ykh8qczlyd00000gn/T/pip-install-0fq2nxsl/mojimoji/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/y3/pbwjdvvd6g3f5ykh8qczlyd00000gn/T/pip-record-6cg8gdn2/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/y3/pbwjdvvd6g3f5ykh8qczlyd00000gn/T/pip-install-0fq2nxsl/mojimoji/


どうやら、↓が原因みたい。

https://stackoverflow.com/questions/42030598/mac-c-compiler-not-finding-tr1-unordered-map

【対処】

git clone https://github.com/studio-ousia/mojimoji

python3 setup.py install

でインストールできた。