SamuraiT / mecab-python3

:snake: mecab-python. you can find original version here:http://taku910.github.io/mecab/
https://pypi.python.org/pypi/mecab-python3
Other
541 stars 51 forks source link

No such file or directory: 'mecab-config' issue #95

Closed phudang-135 closed 1 year ago

phudang-135 commented 1 year ago

python 3.9.16 pip 23.1.2

I try to install the mecab-python3 on windows. However, I run into the error in which the 'mecab-config' was not found. I have try searching on how to resolve the issue with no luck. Here is the error log:

  error: subprocess-exited-with-error

  × Building wheel for mecab-python3 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.cygwin-3.4.7-x86_64-cpython-39
      creating build/lib.cygwin-3.4.7-x86_64-cpython-39/MeCab
      copying src/MeCab/cli.py -> build/lib.cygwin-3.4.7-x86_64-cpython-39/MeCab
      copying src/MeCab/__init__.py -> build/lib.cygwin-3.4.7-x86_64-cpython-39/MeCab
      warning: build_py: byte-compiling is disabled, skipping.

      running build_ext
      error: [Errno 2] No such file or directory: 'mecab-config'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mecab-python3
Failed to build mecab-python3
ERROR: Could not build wheels for mecab-python3, which is required to install pyproject.toml-based projects

Thank you for your time

polm commented 1 year ago

It looks like for some reason pip is trying to install from source and not using the pre-compiled wheel, even though one should be available. If you download the file for Windows and Python 3.9 from here can you pip install it?

To be clear, the mecab-config error is because you do not have MeCab installed separately. If you use a pre-compiled wheel, which is recommended, that doesn't matter, but if you build from source you need MeCab installed.

phudang-135 commented 1 year ago

It looks like for some reason pip is trying to install from source and not using the pre-compiled wheel, even though one should be available. If you download the file for Windows and Python 3.9 from here can you pip install it?

To be clear, the mecab-config error is because you do not have MeCab installed separately. If you use a pre-compiled wheel, which is recommended, that doesn't matter, but if you build from source you need MeCab installed.

Hi,

Thank you, I have tried download the wheel for 64-bit Windows with cp39. When I installed, the error said 'ERROR: mecab_python3-1.0.6-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.' I check the supported tag for pip, and it support: 'cp39-cp39-cygwin_3_4_7_x86_64', 'cp39-none-cygwin_3_4_7_x86_64', and 'cyp39-none-any'. I think that is why pip is attempting to build from source because it cannot find compatible tags. If I rename the wheel and tell pip to install it, would it work? Or do I need to install the wheel through my native terminal and not through cygwin.

Thank you.

polm commented 1 year ago

Ah, it didn't occur to me that you're using Cygwin. I am surprised that the normal Windows wheels would show up as unsupported - while I don't use Cygwin often, and it has been at least six months since the last time I did, I always just installed Windows wheels without thinking about it.

I'm not sure, but maybe you're using a Python you installed with Cygwin? If that's the case, could you try using Python for Windows from Cygwin instead? In that case I think it should just work as usual. If that doesn't work, I'd recommend installing MeCab via Cygwin first and then installing this package.

phudang-135 commented 1 year ago

Ah, it didn't occur to me that you're using Cygwin. I am surprised that the normal Windows wheels would show up as unsupported - while I don't use Cygwin often, and it has been at least six months since the last time I did, I always just installed Windows wheels without thinking about it.

I'm not sure, but maybe you're using a Python you installed with Cygwin? If that's the case, could you try using Python for Windows from Cygwin instead? In that case I think it should just work as usual. If that doesn't work, I'd recommend installing MeCab via Cygwin first and then installing this package.

ah, thank you. I have decided to just run straight from the command prompt and install it successfully. Thank you for your time.

brian316 commented 7 months ago

running pip install -e gives me this error as well while installing on WSL.

Solution: install headers sudo apt install libmecab-dev

polm commented 7 months ago

@brian316 If you are using pip install -e on a local checkout you are building from source and need a local copy of the MeCab library and headers. If you do not have a particualr reason for doing that, it is strongly recommended you use wheels.

Also note that WSL and Cygwin are very different. I would expect WSL to be able to use the same wheels as Linux.

brian316 commented 7 months ago

i also used pip install mecab-python3 but when installing MeloTTS pip install git+https://github.com/myshell-ai/MeloTTS.git it wouldn't recognize that it was already installed and wanted to build it. I know that is more of a problem with that other library but wanted to post my solution in case others have issues building from source as well.

marce1994 commented 5 months ago

Dunno if it is a fix, but for MeloTTS updating to mecab-python3==1.0.6 worked for me

polm commented 5 months ago

Looking at their requirements.txt, MeloTTS requires 1.0.5, which is from 2022 and doesn't have wheels for Python 3.11 or higher. You should be able to upgrade to the most recent version of this library to fix that.