Pip install results in this error cl.exe failed with exit code 2

2024/10/18 12:59:51

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 directoryerror: 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?

Answer

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.

https://en.xdnf.cn/q/72252.html

Related Q&A

how to communicate two separate python processes?

I have two python programs and I want to communicate them. Both of them are system services and none of them is forked by parent process.Is there any way to do this without using sockets? (eg by cra…

Why does one use of iloc() give a SettingWithCopyWarning, but the other doesnt?

Inside a method from a class i use this statement:self.__datacontainer.iloc[-1][c] = valueDoing this i get a "SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a Data…

Tkinter color name to color object

I need to modify a widgets color in some way, for example, to make it darker, greener, to invert it. The widgets color is given by name, for example, orchid4. How do I get RGB values from a color name …

Creating a TfidfVectorizer over a text column of huge pandas dataframe

I need to get matrix of TF-IDF features from the text stored in columns of a huge dataframe, loaded from a CSV file (which cannot fit in memory). I am trying to iterate over dataframe using chunks but…

Automatically convert jupyter notebook to .py

I know there have been a few questions about this but I have not found anything robust enough.Currently I am using, from terminal, a command that creates .py, then moves them to another folder:jupyter …

Schematron validation with lxml in Python: how to retrieve validation errors?

Im trying to do some Schematron validation with lxml. For the specific application Im working at, its important that any tests that failed the validation are reported back. The lxml documentation menti…

Getting Query Parameters as Dictionary in FastAPI [duplicate]

This question already has answers here:How to get query params including keys with blank values using FastAPI?(2 answers)Closed 6 months ago.I spent last month learning Flask, and am now moving on to …

Python Generated Signature for S3 Post

I think Ive read nearly everything there is to read on base-64 encoding of a signature for in-browser, form-based post to S3: old docs and new docs. For instance:http://doc.s3.amazonaws.com/proposals/…

Bringing a classifier to production

Ive saved my classifier pipeline using joblib: vec = TfidfVectorizer(sublinear_tf=True, max_df=0.5, ngram_range=(1, 3)) pac_clf = PassiveAggressiveClassifier(C=1) vec_clf = Pipeline([(vectorizer, vec)…

how to count the frequency of letters in text excluding whitespace and numbers? [duplicate]

This question already has answers here:Using a dictionary to count the items in a list(10 answers)Closed last year.Use a dictionary to count the frequency of letters in the input string. Only letters s…