简体   繁体   中英

pip not installing existing package

I'm trying to install spacy 2.1.0 using pip . However, I'm running into an issue where I get an error message stating that

ERROR: Could not find a version that satisfies the requirement spacy==2.1.0 
(from versions: 0.31, 0.32, 0.33, 0.40, 0.51, 0.52, 0.60, 0.61, 0.62, 0.63, 0.64, 0.65, 0.67, 0.68, 0.70, 
0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.97, 
0.98, 0.99, 0.100.0, 0.100.1, 0.100.2, 0.100.3, 0.100.4, 0.100.5, 0.100.6, 0.100.7, 0.101.0, 1.0.1, 
1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 
1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.5, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.10.0, 1.10.1, 2.0.0, 
2.0.1.dev0, 2.0.1, 2.0.2.dev0, 2.0.2, 2.0.3.dev0, 2.0.3, 2.0.4.dev0, 2.0.4, 2.0.5.dev0, 2.0.5, 
2.0.6.dev0, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10.dev0, 2.0.10, 2.0.11.dev0, 2.0.11, 2.0.12.dev0, 
2.0.12.dev1, 2.0.12, 2.0.13.dev0, 2.0.13.dev1, 2.0.13.dev2, 2.0.13.dev4, 2.0.13, 2.0.14.dev0, 
2.0.14.dev1, 2.0.15, 2.0.16.dev0, 2.0.16, 2.0.17.dev0, 2.0.17.dev1, 2.0.17, 2.0.18.dev0, 
2.0.18.dev1, 2.0.18, 2.1.0, 2.1.1.dev0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.1.7.dev0, 
2.1.7, 2.1.8, 2.1.9, 2.2.0.dev10, 2.2.0.dev11, 2.2.0.dev13, 2.2.0.dev15, 2.2.0.dev17, 
2.2.0.dev18, 2.2.0.dev19, 2.2.0, 2.2.1, 2.2.2.dev0, 2.2.2.dev4, 2.2.2, 2.2.3.dev0, 2.2.3, 2.2.4, 
2.3.0.dev1, 2.3.0, 2.3.1, 2.3.2, 2.3.3.dev0, 2.3.3, 2.3.4, 2.3.5, 3.0.0, 3.0.1.dev0, 3.0.1, 
3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6)
ERROR: No matching distribution found for spacy==2.1.0

I find this weird because it says that it searched through version 2.1.0 (11th line of the message), but it still didn't detect it.

My version of pip has the latest update. I'm working in a virtual environment. I'm on macOS Big Sur Version 11.1. I'm using Python 3.8.3 . To reproduce the error, set up a clear virtual environment with the latest version of pip 21.1 , run pip install spacy==2.1.0 . Then, after waiting for some time, the error message should pop up.

I'm unsure why this message seems to be happening as it knows that spacy 2.1.0 exists. I've had this error with other packages too, such as scikit-learn . I've also attempted installing directly from a tar.gz file to no avail. Then, I get an error that it exited with status 1 . Nevertheless, if you all have any solutions on how I can succesfully install this version of spacy , I'd greatly appreciate it.

Also, I'm kinda new to posting on stack overflow , so if there is anything that is missing from my message that would help you, don't hesitate to let me know. Thanks:D

The answer from @RMPR is a good suggestion in general, but I suspect you're still going to run into problems with the required version of the dependency blis , which has some out-dated/hacky OS X settings that are probably the source of the original install error.

Run the following to see if there is an error towards the end about mismatched MACOSX_DEPLOYMENT_TARGET versions (it will take a few minutes to get that far; you can stop the command as soon as you see this error):

python -m pip install blis==0.2.4

The error looks like this:

  error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.7" but "10.14.6" during configure
  ----------------------------------------
  ERROR: Failed building wheel for blis

10.7 is the out-dated hard-coded default from blis==0.2.4 , so set it to the right value from the error message. In my example, this worked:

MACOSX_DEPLOYMENT_TARGET="10.14.6" python -m pip install spacy==2.1.0

(Caveat: I could only test this in emulation mode on an M1.)

Looking at the wheels on PyPI it seems like there are no build currently for macosx 11 (Big Sur) the closest is this one that you can install by using:

pip install https://files.pythonhosted.org/packages/9a/97/4cac1c4ac95af031b627968120bf273193e2f2134ff01b069cf630414272/spacy-3.0.6-cp38-cp38-macosx_10_9_x86_64.whl

But you should get an error message stating that the wheel is not supported on the platform. And that's probably why even though pip listed the version of the library you still got that error message. You either have to downgrade to a supported macOS version or install from source (instructions on how to install the v2.1.0 below).

You need to first install a recent version of XCode, including the "Command Line Tools" then:

git clone https://github.com/explosion/spaCy
cd spaCy

python -m venv .env
source .env/bin/activate

# make sure you are using the latest pip
python -m pip install -U pip setuptools wheel

# checkout to the desired version of spaCy
git checkout v2.1.0

pip install -r requirements.txt
pip install --no-build-isolation --editable .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM