Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install sentencepiece with Python 3.9 on Windows #591

Closed
seemethere opened this issue Dec 3, 2020 · 16 comments
Closed

Cannot install sentencepiece with Python 3.9 on Windows #591

seemethere opened this issue Dec 3, 2020 · 16 comments

Comments

@seemethere
Copy link

seemethere commented Dec 3, 2020

Currently adding Python 3.9 support for pytorch/text and ran into an issue installing sentencepiece for Python 3.9 on windows. (CircleCI logs)

  ERROR: Failed building wheel for sentencepiece
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\circleci\project\env\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\circleci\\AppData\\Local\\Temp\\pip-install-trvw9qva\\sentencepiece_6ae2202249f44bf5b7a3902ec8532c93\\setup.py'"'"'; __file__='"'"'C:\\Users\\circleci\\AppData\\Local\\Temp\\pip-install-trvw9qva\\sentencepiece_6ae2202249f44bf5b7a3902ec8532c93\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\circleci\AppData\Local\Temp\pip-record-xi27zjv8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\circleci\project\env\Include\sentencepiece'
         cwd: C:\Users\circleci\AppData\Local\Temp\pip-install-trvw9qva\sentencepiece_6ae2202249f44bf5b7a3902ec8532c93\
    Complete output (20 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\sentencepiece
    copying src\sentencepiece/__init__.py -> build\lib.win-amd64-3.9\sentencepiece
    copying src\sentencepiece/sentencepiece_model_pb2.py -> build\lib.win-amd64-3.9\sentencepiece
    copying src\sentencepiece/sentencepiece_pb2.py -> build\lib.win-amd64-3.9\sentencepiece
    running build_ext
    building 'sentencepiece._sentencepiece' extension
    creating build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release
    creating build\temp.win-amd64-3.9\Release\src
    creating build\temp.win-amd64-3.9\Release\src\sentencepiece
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\circleci\project\env\include -IC:\Users\circleci\project\env\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\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 /EHsc /Tpsrc/sentencepiece/sentencepiece_wrap.cxx /Fobuild\temp.win-amd64-3.9\Release\src/sentencepiece/sentencepiece_wrap.obj /MT /I..\build\root\include
    cl : Command line warning D9025 : overriding '/MD' with '/MT'
    sentencepiece_wrap.cxx
    src/sentencepiece/sentencepiece_wrap.cxx(2777): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

This is a duplicate of #452, but no real solution to building from source seems to have come from that so I have opened a new issue

Is there a workaround for getting this dependency?

cc @taku910

@zcain117
Copy link

zcain117 commented Dec 3, 2020

@taku910 have you seen this error before?

@lunixbochs
Copy link
Contributor

The appveyor image they're using doesn't support python 3.9
Doesn't seem like this package is trivially pip installable if it's not prebuilt on windows - seems to require the C++ sentencepiece built and installed first.

appveyor/ci#3541 (comment)

@lunixbochs
Copy link
Contributor

You can manually grab a windows cp39 wheel from here until the maintainers cut a new release: https://ci.appveyor.com/project/taku910/sentencepiece/build/job/djp9386oghmdunxg/artifacts

@ghm
Copy link

ghm commented Dec 19, 2020

I had the same problem. My system is Red Hat Enterprise Linux Server release 6.4 (Santiago). Where can I manually grab a Linux cp37 wheel with Python 3.7?

The versions of here are not suitable for my system.
When I install sentencepiece-0.1.94-cp37-cp37m-manylinux2014_x86_64.whl, as the following:
image
But when I import it, it was as follows:
image

@taku910
Copy link
Collaborator

taku910 commented Jan 10, 2021

v0.19.5 supports Python 3.9 & windows

@BastianZim
Copy link

I'm running into the same problem with pip. Installing from source using setup.py build and setup.py install works but installing it using python -m pip install . -vv doesn't.
The error is src/sentencepiece/sentencepiece_wrap.cxx(2809): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory

Has anyone figured out why?

Logs: https://github.com/conda-forge/sentencepiece-feedstock/runs/1844854080

@IMJONEZZ
Copy link

IMJONEZZ commented Jun 8, 2021

Bumping this issue again, Python 3.8 can't install sentencepiece on Windows through pip or any available wheels.

@Dontpanice
Copy link

Hi,

I got the same issue but for me the problem was the following. (Using python 3.9)

installing the package from packages/sentencepiece/0.1.96/sentencepiece-0.1.96.tar.gz yielded this exact error as first post in this thread. But if I insalled it form a wheel, packages/sentencepiece/0.1.95/sentencepiece-0.1.95-cp39-cp39-win_amd64.whl
it worked.

@cibernicola
Copy link

cibernicola commented Sep 19, 2022

Error alive again, Windows 10, Python 3.10.7

` Attempting uninstall: sentencepiece
Found existing installation: sentencepiece 0.1.97
Uninstalling sentencepiece-0.1.97:
Successfully uninstalled sentencepiece-0.1.97
Running setup.py install for sentencepiece ... error
error: subprocess-exited-with-error

× Running setup.py install for sentencepiece did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
C:\Python310\lib\site-packages\setuptools\dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running install
C:\Python310\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
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\sentencepiece
copying src\sentencepiece/init.py -> build\lib.win-amd64-cpython-310\sentencepiece
copying src\sentencepiece/sentencepiece_model_pb2.py -> build\lib.win-amd64-cpython-310\sentencepiece
copying src\sentencepiece/sentencepiece_pb2.py -> build\lib.win-amd64-cpython-310\sentencepiece
running build_ext
building 'sentencepiece._sentencepiece' extension
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
creating build\temp.win-amd64-cpython-310\Release\src
creating build\temp.win-amd64-cpython-310\Release\src\sentencepiece
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Python310\include -IC:\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\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" /EHsc /Tpsrc/sentencepiece/sentencepiece_wrap.cxx /Fobuild\temp.win-amd64-cpython-310\Release\src/sentencepiece/sentencepiece_wrap.obj /MT /I..\build\root\include
cl : L¡nea de comandos warning D9025 : invalidando '/MD' con '/MT'
sentencepiece_wrap.cxx
src/sentencepiece/sentencepiece_wrap.cxx(2809): fatal error C1083: No se puede abrir el archivo incluir: 'sentencepiece_processor.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\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.
Rolling back uninstall of sentencepiece
Moving to c:\python310\lib\site-packages\sentencepiece-0.1.97.dist-info
from C:\Python310\Lib\site-packages~entencepiece-0.1.97.dist-info
Moving to c:\python310\lib\site-packages\sentencepiece
from C:\Python310\Lib\site-packages~entencepiece
error: legacy-install-failure

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

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

Edit:
This path: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64" exists, and cl.exe is there too.

@Miaohy12138
Copy link

I got the same thing

@FrancescoFernicola
Copy link

Hello everyone,

I receive the same message with python 3.11.0 on Win 10.
I also tried installing from source but I receive the same error message:

src/sentencepiece/sentencepiece_wrap.cxx(2822): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory

@Catalyst-Studio
Copy link

same here

Hello everyone,

I receive the same message with python 3.11.0 on Win 10. I also tried installing from source but I receive the same error message:

src/sentencepiece/sentencepiece_wrap.cxx(2822): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory

same here

@jpschw
Copy link

jpschw commented Mar 20, 2023

Getting the same error

@tjohnman
Copy link

I had the same issue and I followed the instructions to build from source here and they worked:
https://github.com/google/sentencepiece/blob/master/python/README.md

The only difference is I was using CMake GUI and Visual Studio to generate a solution and build the INSTALL project it generated.

@Juniornewxt
Copy link

It worked for me using an older version of python, I used 3.10

@kaleidosgu
Copy link

I didn't downgrade Python, instead I modified the requirements.txt file and added the following version information:
sentencepiece==0.1.99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests