polm / fugashi

A Cython MeCab wrapper for fast, pythonic Japanese tokenization and morphological analysis.
MIT License
389 stars 31 forks source link

Unable to Install (Windows x64, Python 3.11.0, fugashi 1.2.0) #66

Closed Survivian closed 1 year ago

Survivian commented 1 year ago
C:\Users\sonic>python --version --version
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]

C:\Users\sonic>python -m pip instal fugashi
ERROR: unknown command "instal" - maybe you meant "install"

C:\Users\sonic>python -m pip install fugashi
Collecting fugashi
  Using cached fugashi-1.2.0.tar.gz (337 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: fugashi
  Building wheel for fugashi (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      C:\Users\sonic\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\fugashi
      copying fugashi\cli.py -> build\lib.win-amd64-cpython-311\fugashi
      copying fugashi\__init__.py -> build\lib.win-amd64-cpython-311\fugashi
      running build_ext
      cythoning fugashi/fugashi.pyx to fugashi\fugashi.c
      building 'fugashi.fugashi' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\fugashi
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\mecab -IC:\Users\sonic\AppData\Local\Programs\Python\Python311\include -IC:\Users\sonic\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcfugashi\fugashi.c /Fobuild\temp.win-amd64-cpython-311\Release\fugashi\fugashi.obj
      fugashi.c
      fugashi\fugashi.c(744): fatal error C1083: Cannot open include file: 'mecab.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  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: subprocess-exited-with-error

  × Running setup.py install for fugashi did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      C:\Users\sonic\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      running install
      C:\Users\sonic\AppData\Local\Programs\Python\Python311\Lib\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\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\fugashi
      copying fugashi\cli.py -> build\lib.win-amd64-cpython-311\fugashi
      copying fugashi\__init__.py -> build\lib.win-amd64-cpython-311\fugashi
      running build_ext
      skipping 'fugashi\fugashi.c' Cython extension (up-to-date)
      building 'fugashi.fugashi' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\fugashi
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\mecab -IC:\Users\sonic\AppData\Local\Programs\Python\Python311\include -IC:\Users\sonic\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcfugashi\fugashi.c /Fobuild\temp.win-amd64-cpython-311\Release\fugashi\fugashi.obj
      fugashi.c
      fugashi\fugashi.c(744): fatal error C1083: Cannot open include file: 'mecab.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> fugashi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Similar to some other issues posted here, I ran into one when trying to install fugashi for cutlet where it would refuse to build the wheel until I added the MeCab version that issue #44 linked into my C:\ drive. Once I added that, it installed without issue, but it's still frustrating that I had to go hunt this down.

I feel that maybe it should be added somewhere in the readme about where to download this fork of MeCab in case installation gets a bit wonky.

Sorry for the inconvenience.

polm commented 1 year ago

Sorry that was tricky. The main issue here is that I haven't published wheels for 3.11 yet, so your machine tried to build from source. You should be able to resolve that by installing any version of MeCab, not just the one I happen to use, though I think the original MeCab doesn't build on Windows at the moment.

I'll look at adding a link to the Windows version to the README in any case.

Survivian commented 1 year ago

Thanks for the quick response! I should've figured seeing the last release date on the current version of fugashi, but I just got around to installing Python on this machine 5 hours before this since I hadn't done it yet surprisingly. Hopefully the link to that version of MeCab in the readme helps out more people!

polm commented 1 year ago

I added a note about the fork I use to the README, so this should be resolved. I should also release 3.11 wheels soon so this isn't an issue at all.