Closed KakoozaJerry closed 3 years ago
Hey, sorry you're having trouble with this. It looks like pip is trying to install mecab-python3 from source, which shouldn't happen. What version of Python and pip do you have?
This package doesn't have arm64 OSX wheels, but my understanding is that the x86 wheels should work. Maybe you could try downloading a wheel from here and installing it directly:
@polm , below is my pip and python version
pip 21.2.3 from /Users/jerry/miniforge3/envs/test_env/lib/python3.8/site-packages/pip (python 3.8)
Let me try downloading it directly, Thank you
Hm, that looks like it should work. Let me know if the direct download works or not.
So the direct download has failed to work too
(test_env) jerry@Abrahams-MacBook-Pro Downloads % python3 -m pip install ./mecab_python3-1.0.4-cp36-cp36m-macosx_10_14_x86_64.whl
ERROR: mecab_python3-1.0.4-cp36-cp36m-macosx_10_14_x86_64.whl is not a supported wheel on this platform.
@polm , I also tried this below still failed
(test_env) jerry@Abrahams-MacBook-Pro Downloads % python3 -m pip install ./mecab_python3-1.0.4-cp36-cp36m-macosx_10_14_x86_64.whl
ERROR: mecab_python3-1.0.4-cp36-cp36m-macosx_10_14_x86_64.whl is not a supported wheel on this platform.
(test_env) jerry@Abrahams-MacBook-Pro Downloads % python3 -m pip install ./mecab_python3-1.0.4-cp38-cp38-macosx_10_14_x86_64.whl
ERROR: mecab_python3-1.0.4-cp38-cp38-macosx_10_14_x86_64.whl is not a supported wheel on this platform.
(test_env) jerry@Abrahams-MacBook-Pro Downloads % python3 -m pip install ./mecab-python3-1.0.4.tar
Processing ./mecab-python3-1.0.4.tar
Building wheels for collected packages: mecab-python3
Building wheel for mecab-python3 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/jerry/miniforge3/envs/test_env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/setup.py'"'"'; __file__='"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/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/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-wheel-bqit2629
cwd: /private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/
Complete output (10 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-11.0-arm64-3.8
creating build/lib.macosx-11.0-arm64-3.8/MeCab
copying src/MeCab/__init__.py -> build/lib.macosx-11.0-arm64-3.8/MeCab
copying src/MeCab/cli.py -> build/lib.macosx-11.0-arm64-3.8/MeCab
running build_ext
error: [Errno 2] No such file or directory: 'mecab-config'
----------------------------------------
ERROR: Failed building wheel for mecab-python3
Running setup.py clean for mecab-python3
Failed to build mecab-python3
Installing collected packages: mecab-python3
Running setup.py install for mecab-python3 ... error
ERROR: Command errored out with exit status 1:
command: /Users/jerry/miniforge3/envs/test_env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/setup.py'"'"'; __file__='"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/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/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-record-3wl5v8nk/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jerry/miniforge3/envs/test_env/include/python3.8/mecab-python3
cwd: /private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/
Complete output (10 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-11.0-arm64-3.8
creating build/lib.macosx-11.0-arm64-3.8/MeCab
copying src/MeCab/__init__.py -> build/lib.macosx-11.0-arm64-3.8/MeCab
copying src/MeCab/cli.py -> build/lib.macosx-11.0-arm64-3.8/MeCab
running build_ext
error: [Errno 2] No such file or directory: 'mecab-config'
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jerry/miniforge3/envs/test_env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/setup.py'"'"'; __file__='"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-req-build-9yj4tqa_/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/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-record-3wl5v8nk/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jerry/miniforge3/envs/test_env/include/python3.8/mecab-python3 Check the logs for full command output.
(test_env) jerry@Abrahams-MacBook-Pro Downloads %
That's weird, but it looks like the OSX version name in the wheel file can cause issues. Note that only the cp38 file should work since you're using Python 3.8.
I need to look into the OSX fix more, but here's a couple of things you can try:
python3 -m pip install fugashi
python3 -m pip install -U pip
10_14
part of the wheel filename to be 11_2
Related issue:
Tried installing fugashi , returns kind of a similar error
Collecting fugashi
Using cached fugashi-1.1.1.tar.gz (337 kB)
Building wheels for collected packages: fugashi
Building wheel for fugashi (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/jerry/miniforge3/envs/test_env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/setup.py'"'"'; __file__='"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/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/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-wheel-4t71imuz
cwd: /private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/
Complete output (20 lines):
fatal: destination path 'mecab' already exists and is not an empty directory.
make: `libmecab.la' is up to date.
running bdist_wheel
running build
running build_py
creating build/lib.macosx-11.0-arm64-3.8
creating build/lib.macosx-11.0-arm64-3.8/fugashi
copying fugashi/__init__.py -> build/lib.macosx-11.0-arm64-3.8/fugashi
copying fugashi/cli.py -> build/lib.macosx-11.0-arm64-3.8/fugashi
running build_ext
cythoning fugashi/fugashi.pyx to fugashi/fugashi.c
building 'fugashi.fugashi' extension
creating build/temp.macosx-11.0-arm64-3.8
creating build/temp.macosx-11.0-arm64-3.8/fugashi
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jerry/miniforge3/envs/test_env/include -arch arm64 -I/Users/jerry/miniforge3/envs/test_env/include -arch arm64 -I/Users/jerry/miniforge3/envs/test_env/include/python3.8 -c fugashi/fugashi.c -o build/temp.macosx-11.0-arm64-3.8/fugashi/fugashi.o
fugashi/fugashi.c:618:10: fatal error: 'mecab.h' file not found
#include "mecab.h"
^~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for fugashi
Running setup.py clean for fugashi
Failed to build fugashi
Installing collected packages: fugashi
Running setup.py install for fugashi ... error
ERROR: Command errored out with exit status 1:
command: /Users/jerry/miniforge3/envs/test_env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/setup.py'"'"'; __file__='"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/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/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-record-mz6_annn/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jerry/miniforge3/envs/test_env/include/python3.8/fugashi
cwd: /private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/
Complete output (20 lines):
fatal: destination path 'mecab' already exists and is not an empty directory.
make: `libmecab.la' is up to date.
running install
running build
running build_py
creating build/lib.macosx-11.0-arm64-3.8
creating build/lib.macosx-11.0-arm64-3.8/fugashi
copying fugashi/__init__.py -> build/lib.macosx-11.0-arm64-3.8/fugashi
copying fugashi/cli.py -> build/lib.macosx-11.0-arm64-3.8/fugashi
running build_ext
skipping 'fugashi/fugashi.c' Cython extension (up-to-date)
building 'fugashi.fugashi' extension
creating build/temp.macosx-11.0-arm64-3.8
creating build/temp.macosx-11.0-arm64-3.8/fugashi
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jerry/miniforge3/envs/test_env/include -arch arm64 -I/Users/jerry/miniforge3/envs/test_env/include -arch arm64 -I/Users/jerry/miniforge3/envs/test_env/include/python3.8 -c fugashi/fugashi.c -o build/temp.macosx-11.0-arm64-3.8/fugashi/fugashi.o
fugashi/fugashi.c:618:10: fatal error: 'mecab.h' file not found
#include "mecab.h"
^~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jerry/miniforge3/envs/test_env/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/setup.py'"'"'; __file__='"'"'/private/var/folders/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-install-df__3ns9/fugashi_106118f5803b41df819907747c3fd248/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/jd/p_kqgjxx58jbhvrw6gdrgd6r0000gn/T/pip-record-mz6_annn/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jerry/miniforge3/envs/test_env/include/python3.8/fugashi Check the logs for full command output.
(test_env) jerry@Abrahams-MacBook-Pro
I also upgraded the pip version. It was already up to date ,
Changing the part of 10_14
to 11_2
returned file not recognised.
That leaves me with only the last option of a related issue
Ah, sorry none of those worked.
I am still going through the related issue myself, but if you want to look at it it might provide useful reference. Unfortunately the only thing that looks like it might be a thorough fix (towards the bottom of the thread) looks somewhat involved and doesn't have many people chiming in.
Hey, I am kind of out of ideas on this one, sorry. I will keep looking at reports of similar errors but I'm not sure when I'll have more advice. I do not have any OSX devices I can test on either.
The only thing I could recommend is maybe trying using a non-anaconda Python. Sometimes conda has install errors that are hard to track down or replicate.
Alternately, you could install MeCab from source, in which case you can install this library from source. If you're used to installing C++ libraries from source that shouldn't be too bad. Another option is to use a non-compiled tokenizer like Janome, which will be slower and use the obsolete IPADic, but it should be platform independent.
If I see anything likely in related issues I'll mention it here but I can't promise anything, sorry.
I think I figured out your issue, it seems it's kind of like #72.
mecab-python3 only has x86_64 wheels for OSX. On M1 machines, arm64 and x86_64 wheels are both usable, but the version you use must match the version of Python you have.
It seems you are using an arm64 version of Python. If you switch to an x86_64 version it should just work. If you want to keep using arm64, that should work, but you'll have to build MeCab and this package from source yourself.
Miniconda has both arm64 and x86_64 versions on OSX, thought the arm64 version is still experimental.
Hello @polm, You are very right on this. I did switch to the intel architecture in my conda environment but the python version was still showing an arm64 architecture.
Could you please share with me the miniconda install link for the arm64 version. Thank you
This is very right @polm . I did switch architectures to the x86_64 and when I normally run in my terminal checking the architecture, it is ok but when I check the architecture of the python version in my anaconda within the python console, it brings back arm64 architecture.
Python 3.8.6 | packaged by conda-forge | (default, Jan 25 2021, 22:55:00)
[Clang 11.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.uname()[4]
'arm64'
>>> quit()
(test_env) jerry@Abrahams-MBP Downloads % arch
i386
(test_env) jerry@Abrahams-MBP Downloads %
I guess am gonna try seeing if I can have the python setup in my conda environment show up x86_64 instead or arm 64. So I did install the wheels on my default python which is not in the environment and it was able to install them successfully. i.e after switching architecture.
Glad to hear that explains your issue!
You can find the x86_64 OSX miniconda installer here.
Since I think this is resolved I'm going to go ahead and close it, but let me know if you need help with anything else.
Same error, MacOS 12.5.1 (arm64 aka M1), Python 3.9.13
/Users/artem/Desktop/tts/env/lib/python3.9/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
WARNING: The wheel package is not available.
WARNING: The wheel package is not available.
running install
/Users/artem/Desktop/tts/env/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-12-arm64-cpython-39
creating build/lib.macosx-12-arm64-cpython-39/MeCab
copying src/MeCab/__init__.py -> build/lib.macosx-12-arm64-cpython-39/MeCab
copying src/MeCab/cli.py -> build/lib.macosx-12-arm64-cpython-39/MeCab
running build_ext
error: [Errno 2] No such file or directory: 'mecab-config'
pip freeze
appdirs==1.4.4
audioread==3.0.0
Babel==2.10.3
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
coqpit==0.0.16
cycler==0.11.0
Cython==0.29.28
dateparser==1.1.1
decorator==5.1.1
docopt==0.6.2
fonttools==4.36.0
fsspec==2022.7.1
gruut==2.2.3
gruut-ipa==0.13.0
gruut-lang-cs==2.0.0
gruut-lang-de==2.0.0
gruut-lang-en==2.0.0
gruut-lang-es==2.0.0
gruut-lang-fr==2.0.2
gruut-lang-it==2.0.0
gruut-lang-nl==2.0.2
gruut-lang-pt==2.0.0
gruut-lang-ru==2.0.0
gruut-lang-sv==2.0.0
idna==3.3
importlib-metadata==4.12.0
itsdangerous==2.1.2
Jinja2==3.1.2
joblib==1.1.0
jsonlines==1.2.0
kiwisolver==1.4.4
llvmlite==0.38.1
MarkupSafe==2.1.1
networkx==2.8.5
num2words==0.5.12
numba==0.55.1
numpy==1.21.6
packaging==21.3
pandas==1.4.3
Pillow==9.2.0
pooch==1.6.0
protobuf==3.19.4
pycparser==2.21
pydantic==1.9.2
pynndescent==0.5.7
pyparsing==3.0.9
pypinyin==0.47.1
pysbd==0.3.4
python-crfsuite==0.9.8
python-dateutil==2.8.2
pytz==2022.2.1
pytz-deprecation-shim==0.1.0.post0
pyworld==0.2.10
PyYAML==6.0
regex==2022.3.2
requests==2.28.1
resampy==0.4.0
scikit-learn==1.1.2
scipy==1.9.0
six==1.16.0
SoundFile==0.10.3.post1
tensorboardX==2.5.1
threadpoolctl==3.1.0
torch==1.12.1
torchaudio==0.12.1
tqdm==4.64.0
trainer==0.0.14
typing_extensions==4.3.0
tzdata==2022.2
tzlocal==4.2
umap-learn==0.5.1
unidic-lite==1.0.8
urllib3==1.26.11
Werkzeug==2.2.2
zipp==3.8.1
As mentioned upthread, the issue is there are no wheels for arm64 because I have no way to automate builds on that architecture. You can use the x86_64 wheels or build from source, which requires installing MeCab first.
Let me make an issue to track this...
Hey, I stumbled here because I got the same error trying to install your package on Apple Silicon.
Regarding the lack of access to that particular architecture, I can recommend using cibuildwheels in combination with macos-latest
runner here at GitHub Actions and building universal packages for both Intel and Apple Silicon. I have successfully used that approach before.
Ah, I forgot to link in the general issue I made: #84. This discussion should continue there.
I have used cibuildwheel before, I'll take another look at it. But as noted in https://github.com/polm/fugashi/issues/55#issue-1137281479, it has previously failed to work. Now that Github has native M1 runners maybe it's working...
Sad to report that the support for native M1 runners only extends to self-hosted ones, and if you don't have access to Apple Silicon yourself, this will not help. Instead of using x86-based wheels, the way might be building a universal
binary on Intel-based runners that GitHub offers.
I was able to compile it myself using the following on an M1 Mac:
pip3 download mecab-python3
tar xfv mecab-python3-1.0.5.tar.gz
cd mecab-python3-1.0.5
brew install mecab
python3 setup.py build
python3 setup.py install
pip3 list
I was able to compile it myself using the following on an M1 Mac:
pip3 download mecab-python3 tar xfv mecab-python3-1.0.5.tar.gz cd mecab-python3-1.0.5 brew install mecab python3 setup.py build python3 setup.py install pip3 list
Thank you very much, this was the easiest fix. I'd never compiled a pip package by myself so I would've been lost without your help.
I was able to compile it myself using the following on an M1 Mac:
pip3 download mecab-python3 tar xfv mecab-python3-1.0.5.tar.gz cd mecab-python3-1.0.5 brew install mecab python3 setup.py build python3 setup.py install pip3 list
For me, only brew install mecab
is enough.
I was able to compile it myself using the following on an M1 Mac:
pip3 download mecab-python3 tar xfv mecab-python3-1.0.5.tar.gz cd mecab-python3-1.0.5 brew install mecab python3 setup.py build python3 setup.py install pip3 list
Thank you!! This helped me out! (I followed the same procedure without doing the >brew install mecab, and it didn't work). Thanks!!
I think I figured out your issue, it seems it's kind of like #72.
mecab-python3 only has x86_64 wheels for OSX. On M1 machines, arm64 and x86_64 wheels are both usable, but the version you use must match the version of Python you have.
It seems you are using an arm64 version of Python. If you switch to an x86_64 version it should just work. If you want to keep using arm64, that should work, but you'll have to build MeCab and this package from source yourself.
Miniconda has both arm64 and x86_64 versions on OSX, thought the arm64 version is still experimental.
Hello, I am struggling with the same problem as you. My problem appears when trying to install TTS, wheels for mecab-python3 cannot be build. Can you help me to fix this since i am kind new here with python and everything with it. How can i switch from arm to x86_64 version? After this what should i do next?
@thekoko89 I am genuinely sorry that you have to deal with this, but I do not develop on a Mac and also am not the developer of TTS (I assume you mean coqui-tts?), so I will have to suggest you look for help elsewhere.
To be clear, coqui-tts only actually uses this package for Japanese, and their decision to make it a requirement even when not using Japanese is a poor engineering decision and sends people here asking for help I can't give. It should also be very easy to fix, though they have indicated they don't consider it important.
If anyone reading this later is having issues with coqui-tts, please contact the maintainers of that package and tell them to list this package as an optional requirement.
I will also be locking this issue and confining further discussion on M1 wheels in general to #84.
As of the latest release, the Coqui AI TTS package should no longer require mecab-python3 by default.
I get this error when I run
pip install mecab-python3