Home > OS >  Pip install results in this error " cl.exe' failed with exit code 2 "
Pip install results in this error " cl.exe' failed with exit code 2 "

Time:02-25

I've read all of the other questions on this error and frustratingly enough, none give a solution that works.

If I run pip install sentencepiece in the cmd line, it gives me the following output.

 src/sentencepiece/sentencepiece_wrap.cxx(2809): fatal error C1083: Cannot open include file: 'sentencepiece_processor.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

I'm running python 3.10.1 and pip 22.0.3 .

*I have the following Microsoft Visual C programs on my windows machine,which I've just done a fresh install of as it was complaining of not having a particular C program. MS VC

I've even added the .exe file to my PATH variables but still I get the same error.

Am I missing a particular Microsoft program on my pc?

CodePudding user response:

I haven't seen this problem in Windows, but for Linux, I would normally reinstall Python after installing the dependencies (such as the MSVC thing). In that case this is especially helpful because I'm often rebuilding (compiling and other related steps) Python/Pip.

Could also just be an error specific to the module and Python version combo you're trying.


From a discussion in the comments:

I have the pyenv-win version manager, so I was able to create venvs and test this for you. With Python 3.10.2, it fails; with Python 3.8.10, it's successful. So, yes, reinstalling does seem to be worthy of your time.

  • Related