polm/fugashi

Question about installing on visual studio 2022 windows

kitty1737 opened this issue · 3 comments

Was trying to install cutlet but it always fails at installing fugashi. I downloaded the mecab directory from the readme.md and put it at c:/mecab (cuz I am on windows) but its still not working for me. what exactly am i doing wrong cuz i have spend several hours on this.
image

What happens when i do "pip install fugashi"

----- Installing 'pip install fugashi' -----
Requirement already satisfied: pip in c:\program files (x86)\microsoft visual studio\shared\python37_86\lib\site-packages (23.2.1)
Requirement already satisfied: install in c:\program files (x86)\microsoft visual studio\shared\python37_86\lib\site-packages (1.3.5)
Collecting fugashi
Using cached fugashi-1.2.1.tar.gz (337 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: fugashi
Building wheel for fugashi (pyproject.toml): started
Building wheel for fugashi (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error

Building wheel for fugashi (pyproject.toml) did not run successfully.
exit code: 1

[35 lines of output]
running bdist_wheel
running build
running build_py
creating build\lib.win32-cpython-37
creating build\lib.win32-cpython-37\fugashi
copying fugashi\cli.py -> build\lib.win32-cpython-37\fugashi
copying fugashi_init_.py -> build\lib.win32-cpython-37\fugashi
running build_ext
Compiling fugashi/fugashi.pyx because it changed.
[1/1] Cythonizing fugashi/fugashi.pyx
building 'fugashi.fugashi' extension
creating build\temp.win32-cpython-37
creating build\temp.win32-cpython-37\Release
creating build\temp.win32-cpython-37\Release\fugashi
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\mecab "-IC:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcfugashi/fugashi.c /Fobuild\temp.win32-cpython-37\Release\fugashi/fugashi.obj
fugashi.c
fugashi/fugashi.c(7032): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7333): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7681): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7713): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7726): warning C4090: '=': different 'const' qualifiers
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\mecab "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\libs" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\PCbuild\win32" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86" libmecab.lib /EXPORT:PyInit_fugashi build\temp.win32-cpython-37\Release\fugashi/fugashi.obj /OUT:build\lib.win32-cpython-37\fugashi\fugashi.cp37-win32.pyd /IMPLIB:build\temp.win32-cpython-37\Release\fugashi\fugashi.cp37-win32.lib
Creating library build\temp.win32-cpython-37\Release\fugashi\fugashi.cp37-win32.lib and object build\temp.win32-cpython-37\Release\fugashi\fugashi.cp37-win32.exp
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_sparse_tostr2
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_dictionary_info
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_strerror
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_dict_index
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_nbest_sparse_tostr
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_nbest_init
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_model_new
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_nbest_next_tonode
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_new
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_sparse_tonode
build\lib.win32-cpython-37\fugashi\fugashi.cp37-win32.pyd : fatal error LNK1120: 10 unresolved externals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\link.exe' failed with exit code 1120
[end of output]

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

What happens when I run "pip install cutlet"

----- Installing 'pip install cutlet' -----
Requirement already satisfied: pip in c:\program files (x86)\microsoft visual studio\shared\python37_86\lib\site-packages (23.2.1)
Requirement already satisfied: install in c:\program files (x86)\microsoft visual studio\shared\python37_86\lib\site-packages (1.3.5)
Collecting cutlet
Using cached cutlet-0.2.1-py3-none-any.whl
Collecting jaconv (from cutlet)
Using cached jaconv-0.3.4-py3-none-any.whl
Collecting fugashi (from cutlet)
Using cached fugashi-1.2.1.tar.gz (337 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting mojimoji (from cutlet)
Using cached mojimoji-0.0.12-cp37-cp37m-win32.whl
Building wheels for collected packages: fugashi
Building wheel for fugashi (pyproject.toml): started
Building wheel for fugashi (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error

Building wheel for fugashi (pyproject.toml) did not run successfully.
exit code: 1

[35 lines of output]
running bdist_wheel
running build
running build_py
creating build\lib.win32-cpython-37
creating build\lib.win32-cpython-37\fugashi
copying fugashi\cli.py -> build\lib.win32-cpython-37\fugashi
copying fugashi_init_.py -> build\lib.win32-cpython-37\fugashi
running build_ext
Compiling fugashi/fugashi.pyx because it changed.
[1/1] Cythonizing fugashi/fugashi.pyx
building 'fugashi.fugashi' extension
creating build\temp.win32-cpython-37
creating build\temp.win32-cpython-37\Release
creating build\temp.win32-cpython-37\Release\fugashi
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\mecab "-IC:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcfugashi/fugashi.c /Fobuild\temp.win32-cpython-37\Release\fugashi/fugashi.obj
fugashi.c
fugashi/fugashi.c(7032): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7333): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7681): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7713): warning C4090: '=': different 'const' qualifiers
fugashi/fugashi.c(7726): warning C4090: '=': different 'const' qualifiers
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\mecab "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\libs" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_86\PCbuild\win32" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86" libmecab.lib /EXPORT:PyInit_fugashi build\temp.win32-cpython-37\Release\fugashi/fugashi.obj /OUT:build\lib.win32-cpython-37\fugashi\fugashi.cp37-win32.pyd /IMPLIB:build\temp.win32-cpython-37\Release\fugashi\fugashi.cp37-win32.lib
Creating library build\temp.win32-cpython-37\Release\fugashi\fugashi.cp37-win32.lib and object build\temp.win32-cpython-37\Release\fugashi\fugashi.cp37-win32.exp
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_sparse_tostr2
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_dictionary_info
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_strerror
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_dict_index
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_nbest_sparse_tostr
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_nbest_init
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_model_new
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_nbest_next_tonode
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_new
fugashi.obj : error LNK2001: unresolved external symbol __imp__mecab_sparse_tonode
build\lib.win32-cpython-37\fugashi\fugashi.cp37-win32.pyd : fatal error LNK1120: 10 unresolved externals
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\link.exe' failed with exit code 1120
[end of output]

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

Where can i find these missing mecab stuff, I'm assuming they're supposed to named like mecab_sparse_tostr2.h or something, and I cant find it anywhere
I'm still very new to github and all this crap so this stuff is kind of hard

polm commented

Sorry you are having trouble with this, I understand this is a lot to learn at once. Please note that this is complicated for MeCab because it is a C++ library, which is not true of many Python libraries. Also note that I do not program on Windows or use Visual Studio, so it's a little hard for me to help you too, though I will do what I can.

I downloaded the mecab directory from the readme.md and put it at c:/mecab (cuz I am on windows) but its still not working for me.

Don't do that, it's not necessary and will not help. You may need to install MeCab to build from source but that doesn't seem to be the problem here.

On Windows, pip install fugashi should not usually attempt to compile anything. Based on that and this output:

creating build\temp.win32-cpython-37\Release\fugashi

It looks like you are using 32 bit Python. Based on my conversations with Windows developers there has been no reason to use it for many years, so I do not support it. You can check if you are using 32 bit Python by running this program:

import platform
print(platform.architecture()[0])

It should output 32bit or 64bit.

I suspect it is 32bit. If that is the case, I recommend you uninstall Python and install the 64 bit version. You should have this option when installing in Visual Studio.

If you are using the 32 bit version on purpose, I would like to know why, so that I can consider adding support. If you are actually using the 64 bit version already, let me know and I will try to figure out what is happening.

Yeah, I found that I was using 32-bit version after running that command. After installing the 64 bit version, I was able to install it successfully and everything works. And no, I wasn't using the 32 bit version with a specific goal in mind. Thanks so much man

polm commented

Great, glad you were able to get it working! Hope you have fun with it.