Could not find a version that satisfies the requir

2019-01-13 07:03发布

I'm installing several Python packages in Ubuntu 12.04 using the following requirements.txt file:

numpy>=1.8.2,<2.0.0
matplotlib>=1.3.1,<2.0.0
scipy>=0.14.0,<1.0.0
astroML>=0.2,<1.0
scikit-learn>=0.14.1,<1.0.0
rpy2>=2.4.3,<3.0.0

and these two commands:

$ pip install --download=/tmp -r requirements.txt
$ pip install --user --no-index --find-links=/tmp -r requirements.txt

(the first one downloads the packages and the second one installs them).

The process is frequently stopped with the error:

  Could not find a version that satisfies the requirement <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) (from versions: )
No matching distribution found for <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2))

which I fix manually with:

pip install --user <package>

and then run the second pip install command again.

But that only works for that particular package. When I run the second pip install command again, the process is stopped now complaining about another required package and I need to repeat the process again, ie: install the new required package manually (with the command above) and then run the second pip install command.

So far I've had to manually install six, pytz, nose, and now it's complaining about needing mock.

Is there a way to tell pip to automatically install all needed dependencies so I don't have to do it manually one by one?

Add: This only happens in Ubuntu 12.04 BTW. In Ubuntu 14.04 the pip install commands applied on the requirements.txt file work without issues.

7条回答
霸刀☆藐视天下
2楼-- · 2019-01-13 07:17

I had installed python3 but my python in /usr/bin/python was still the old 2.7 version

This worked (<pkg> was pyserial in my case):

python3 -m pip install <pkg>

查看更多
够拽才男人
3楼-- · 2019-01-13 07:28

Try installing flask through the powershell using the following command.

>>pip install --isolated Flask

This will allow installation to avoide environment variables and user configuration.

查看更多
别忘想泡老子
4楼-- · 2019-01-13 07:31

Use Command Prompt, and then select Run as administrator.

Upgrade the pip version

To upgrade PIP, type this command, and then press Enter:-

python.exe -m pip install --upgrade pip

Go Back to python path C:\Users\Jack\AppData\Local\Programs\Python\Python37\Scripts

Type jupyter notebook

You will be redirected to http://localhost:8888/undefined/tree - Jupyter Home Page

Hope it helps !!!!!!!!!!!

查看更多
够拽才男人
5楼-- · 2019-01-13 07:38

After 2 hours of searching, I found a way to fix it with just one line of command. You need to know the version of the package (Just search up PACKAGE version).

Command:

python3 -m pip install --pre --upgrade PACKAGE==VERSION.VERSION.VERSION
查看更多
我想做一个坏孩纸
6楼-- · 2019-01-13 07:38

Not always, but in some cases the package already exists. For example - getpass. It is not listed by "pip list" but it can be imported and used:

enter image description here

If I try to pip install getpass I get the following error: "Could not find a version that satisfies the requirement getpass"

查看更多
叛逆
7楼-- · 2019-01-13 07:38

might help

sudo pip install wheel==0.29.0

查看更多
登录 后发表回答