Pip installs old version of package [duplicate] - python

This question already has answers here:
Why is pip installing an old version of my package?
(15 answers)
Closed 2 years ago.
Pip installs old version of my package
$ pip install pywps
Collecting pywps
Downloading pywps-3.2.6.tar.gz (123kB)
...
If you go to https://pypi.python.org/pypi/pywps/ the version 3.2.6 is not even mentioned there.
It's only mentioned at https://pypi.python.org/simple/pywps/
Any idea, why 3.2.6 is prefered over 4.0.0?
Thanks
P.S. Older responses do not seem to apply to this case.

If you run the command with a verbose option (and an up to date pip), you can see what's happening.
pip install -v pywps
It gives the following output:
1 location(s) to search for versions of pywps:
* https://pypi.python.org/simple/pywps/
...
Skipping link https://pypi.python.org/packages/f9/93/5c2c4c95e53b6193bf239ecc49cb859fd77d181311145edd13ba4cd39e09/pywps-4.0.0-py3.5.egg#md5=338eb2e56a36abc684800961b7e4ee0a (from https://pypi.python.org/simple/pywps/); unsupported archive format: .egg
...
Found link https://pypi.python.org/packages/c8/e6/8b88bc134f714f73e296466ab6b5b5a5ad96c44d35dcbcf41ccf9b76a283/pywps-3.2.6.tar.gz#md5=32bbbefacce633baa9147c74e4416c98 (from https://pypi.python.org/simple/pywps/), version: 3.2.6
Using version 3.2.6 (newest of versions: 3.2.6)
"GET /packages/c8/e6/8b88bc134f714f73e296466ab6b5b5a5ad96c44d35dcbcf41ccf9b76a283/pywps-3.2.6.tar.gz HTTP/1.1" 200 123280
Downloading pywps-3.2.6.tar.gz (123kB)
The egg file is ignored because .egg files are not supported in pip. They were supported by easy_install. I think the best solution is to start producing wheel files, which I think for pywps can be universal. If you also want to keep supporting the easy_install command, you can upload the tar.gz file or keep producing eggs.

You can install version 4.0.0 via pip straight from github:
sudo pip install git+https://github.com/geopython/pywps.git#master#egg=pywps

Related

pip using out of date package index

I am trying to install package inside a docker container(python:rc-slim).
As of now I see that most recent azureml-core wheel uploaded to PyPI is:
azureml_core-1.13.0-py3-none-any.whl
but when I run pip install azureml-core==1.13.0 I get following error:
ERROR: Could not find a version that satisfies the requirement
azureml-core==1.13.0 (from versions: 0.1.50, 0.1.57, 0.1.58, 0.1.59,
0.1.65, 0.1.68, 0.1.74, 0.1.80, 1.0rc83, 1.0rc85, 1.0.2, 1.0.6, 1.0.8, 1.0.10, 1.0.15, 1.0.17, 1.0.17.1, 1.0.18, 1.0.21, 1.0.23, 1.0.30, 1.0.33, 1.0.33.1, 1.0.39, 1.0.41, 1.0.41.1, 1.0.43, 1.0.43.1, 1.0.45, 1.0.48, 1.0.53, 1.0.55, 1.0.57, 1.0.57.1, 1.0.60, 1.0.62, 1.0.62.1, 1.0.65, 1.0.65.1, 1.0.69, 1.0.72, 1.0.74, 1.0.76, 1.0.76.1, 1.0.79, 1.0.81, 1.0.81.1, 1.0.83, 1.0.85, 1.0.85.1, 1.0.85.2, 1.0.85.3, 1.0.85.4, 1.0.85.5, 1.0.85.6, 1.1.0rc0, 1.1.1rc0, 1.1.1.1rc0, 1.1.1.2rc0, 1.1.2rc0, 1.1.5, 1.1.5.1, 1.1.5.2, 1.1.5.3, 1.1.5.4, 1.1.5.5, 1.1.5.6, 1.1.5.7)
When installing packages from 'apt-get' I usually have to update the index first but I can't find a comparable command to do that with pip.
azureml-core version 1.1.5.7 supports Python 2.7 and 3.4+.
Starting from version 1.2.0 it only supports Python 3.5+.
From your list of versions I can guess you use Python 2.7 or 3.4. To use a later version of azureml-core you need a later version of Python.
Two possibilities:
the package needs you to use an underscore (since hyphens don't behave) so pip can download it: so run pip install azureml_core==1.13.0
Run with the --no-cache-dir argument, so pip install --no-cache-dir azureml_core==1.13.0. This argument forces pip to refresh it's package cache.

How to install PyTorch on Python 3.7 / Windows 10 with pip

I am trying to install PyTorch 1.3 using pip :
pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
I got the command line from this page :
https://pytorch.org/get-started/locally/#start-locally
It fails, with the following error message :
ERROR: Could not find a version that satisfies the requirement
torch==1.3.1+cpu (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.3.1+cpu
Using verbose mode (-v) give a little more info :
Skipping link: unsupported archive format: .html:
https://download.pytorch.org/whl/torch_stable.html (from -f)
Analyzing links from page https://pypi.org/simple/torch/
It seems pip cannot use the url I provide and will get packages from another URL.
That one support at best Python 3.6. Since I have installed 3.7.5 (which is support by URL initially provided) none of the packages match and it fails.
I could downgrade to 3.6 but since 3.7 is officially supported I would like to try to fix that issue first.
EDIT : pip is up to date. I got exact same error on both Windows 10 and 7 64 bit machines.
Also: the PyTorch page says :
Please ensure that you have met the prerequisites below (e.g., numpy)
But AFAIK does not list any library in that section. During my tests, numpy was installed and up to date.
As requested, here is the full output of pip :
https://pastebin.com/8Wpqp6du
You error is being triggered because the version 1.3.1+cpu doesn't exist.
If you go to pytorch.org you will be able to select a version of pytorch and your OS, where it will give you a command to install pyTorch correctly, for Python 3.7 and PIP use the following:
pip3 install --find-links https://download.pytorch.org/whl/torch_stable.html torch==1.3.1 torchvision==0.4.2
Remember to check that the pip3 binary you are using is the one installed over Python 3.7.
Also, mind that the documentation you are pointing at is for MacOS.

Pip: could not find a version. No matching distribution found

I'm trying to install Flask-ACL:
https://mikeboers.github.io/Flask-ACL
$ pip search acl | grep -i flask
Flask-ACL (0.0.1) - Access control lists for Flask.
flask-miracle-acl (0.2) - The fabric between the Flask framework and Miracle ACL
Flask-Sandbox (0.1.0)- ACL Route controls for Flask
Flask-SimpleACL (1.2)- Simple ACL extension
$ pip install Flask-ACL
Collecting Flask-ACL
Could not find a version that satisfies the requirement Flask-ACL (from versions: )
No matching distribution found for Flask-ACL
What's wrong here?
P.S. Pip was upgraded a few minutes ago.
UPDATE:
$ python --version
Python 2.7.3
I'm running it under virtualenv.
pip install -Iv Flask-ACL
Collecting Flask-ACL
1 location(s) to search for versions of Flask-ACL:
* https://pypi.python.org/simple/flask-acl/
Getting page https://pypi.python.org/simple/flask-acl/
Looking up "https://pypi.python.org/simple/flask-acl/" in the cache
Current age based on date: 507
Freshness lifetime from max-age: 600
Freshness lifetime from request max-age: 600
The response is "fresh", returning cached response
600 > 507
Analyzing links from page https://pypi.python.org/simple/flask-acl/
Could not find a version that satisfies the requirement Flask-ACL (from versions: )
Cleaning up...
No matching distribution found for Flask-ACL
As I can see, there is no such package on Pypi:
https://pypi.python.org/simple/flask-acl/
but this one exist:
https://pypi.python.org/pypi/Flask-ACL
What is wrong with my pip?
The developers of Flask-ACL made a mistake that they did not manage to upload the Flask-ACL library onto PyPi(where pip searches for modules). so you will have to install it using pip from their GitHub page.
You can do so like this:
pip install "git+https://github.com/mikeboers/Flask-ACL"
A more common reason for this type of error is probably that your environment does not meet the package's requirements.
For example, this occurs if your environment's Python version does not match the required Python version specified by the package:
(my_python36_env)> pip install package_that_requires_python37
ERROR: Could not find a version that satisfies the requirement package_that_requires_python37.
ERROR: No matching distribution found for package_that_requires_python37.
Pay attention if your file ~/.pip/pip.conf not contain any additional index-url values.
Then it can trying to look for specific package version in repository that not exists.
Some workaround solution is to remove pip.conf
I had flask installed in the anaconda but it had some issues when it import it using
from tensorflow.keras.applications.imagenet_utils import preprocess_input, decode_predictions
so instead of the above command, i changed it to
from tensorflow.python.keras.applications.imagenet_utils import preprocess_input, decode_predictions
and it worked fine

Unable to install TurboJson 1.3.2 using easy_install

easy_install -U TurboJson is failing with the below error-
user#ubuntu-dev:~$ sudo easy_install -U TurboJSON
Searching for TurboJSON
Reading pypi.python.org/simple/TurboJSON link
Best match: TurboJson 1.3.2
Downloading TurboJson-1.3.2-py2.7.egg#md5=8708fcb8979c661104c9b444e5428484
Processing TurboJson-1.3.2-py2.7.egg
Moving TurboJson-1.3.2-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding TurboJson 1.3.2 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/TurboJson-1.3.2-py2.7.egg
Processing dependencies for TurboJSON
Searching for simplejson>=1.9.1
Reading pypi.python.org/simple/simplejson/ link
Best match: simplejson 3.8.1
Downloading simplejson-3.8.1.tar.gz#md5=b8441f1053edd9dc335ded8c7f98a974
Processing simplejson-3.8.1.tar.gz
Writing /tmp/easy_install-4VcmRi/simplejson-3.8.1/setup.cfg
Running simplejson-3.8.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-4VcmRi/simplejson-3.8.1/egg-dist-tmp-K89rCq
zip_safe flag not set; analyzing archive contents...
simplejson.tests.init: module references file Adding simplejson 3.8.1 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/simplejson-3.8.1-py2.7-linux-x86_64.egg
Searching for PEAK-Rules>=0.5a1.dev-r2600
Reading https://pypi.python.org/simple/PEAK-Rules/
No local packages or download links found for PEAK-Rules>=0.5a1.dev-r2600
error: Could not find suitable distribution for Requirement.parse('PEAK-Rules>=0.5a1.dev-r2600')
user#ubuntu-dev:~$
https://pypi.python.org/simple/peak-rules/ seems to be broken. It does not list any packages which is very strange. Earlier, it was mostly providing PEAK-Rules>=0.5a1.dev-r2713.
From what I can tell, the PyPi page for PEAK-Rules does not have any packages available for installation, as you suspected in your question.
The solution is to install the PEAK-Rules dependency yourself, then install TurboJSON afterwards.
First, run:
easy_install http://www.turbogears.org/2.1/downloads/current/PEAK-Rules-0.5a1.dev-r2686.tar.gz
This should install PEAK-Rules 0.5a1.dev-r2686 successfully, which will satisfy the TurboJSON requirement of PEAK-Rules>=0.5a1.dev-r2600.
Now, if you run (sudo) easy_install -U TurboJSON, the installation should work as intended.

Could not find a version that satisfies the requirement <package>

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.
Although it doesn't really answers this specific question. Others got the same error message with this mistake.
For those who like me initial forgot the -r: Use pip install -r requirements.txt the -r is essential for the command.
The original answer:
https://stackoverflow.com/a/42876654/10093070
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>
This approach (having all dependencies in a directory and not downloading from an index) only works when the directory contains all packages. The directory should therefore contain all dependencies but also all packages that those dependencies depend on (e.g., six, pytz etc).
You should therefore manually include these in requirements.txt (so that the first step downloads them explicitly) or you should install all packages using PyPI and then pip freeze > requirements.txt to store the list of all packages needed.
Just a reminder to whom google this error and come here.
Let's say I get this error:
$ python3 example.py
Traceback (most recent call last):
File "example.py", line 7, in <module>
import aalib
ModuleNotFoundError: No module named 'aalib'
Since it mentions aalib, I was thought to try aalib:
$ python3.8 -m pip install aalib
ERROR: Could not find a version that satisfies the requirement aalib (from versions: none)
ERROR: No matching distribution found for aalib
But it actually wrong package name, ensure pip search(service disabled at the time of writing), or google, or search on pypi site to get the accurate package name:
Then install successfully:
$ python3.8 -m pip install python-aalib
Collecting python-aalib
Downloading python-aalib-0.3.2.tar.gz (14 kB)
...
As pip --help stated:
$ python3.8 -m pip --help
...
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
To have a systematic way to figure out the root causes instead of rely on luck, you can append -vvv option of pip command to see details, e.g.:
$ python3.8 -u -m pip install aalib -vvv
User install by explicit request
Created temporary directory: /tmp/pip-ephem-wheel-cache-b3ghm9eb
Created temporary directory: /tmp/pip-req-tracker-ygwnj94r
Initialized build tracking at /tmp/pip-req-tracker-ygwnj94r
Created build tracker: /tmp/pip-req-tracker-ygwnj94r
Entered build tracker: /tmp/pip-req-tracker-ygwnj94r
Created temporary directory: /tmp/pip-install-jfurrdbb
1 location(s) to search for versions of aalib:
* https://pypi.org/simple/aalib/
Fetching project page and analyzing links: https://pypi.org/simple/aalib/
Getting page https://pypi.org/simple/aalib/
Found index url https://pypi.org/simple
Getting credentials from keyring for https://pypi.org/simple
Getting credentials from keyring for pypi.org
Looking up "https://pypi.org/simple/aalib/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/aalib/ HTTP/1.1" 404 13
[hole] Status code 404 not in (200, 203, 300, 301)
Could not fetch URL https://pypi.org/simple/aalib/: 404 Client Error: Not Found for url: https://pypi.org/simple/aalib/ - skipping
Given no hashes to check 0 links for project 'aalib': discarding no candidates
ERROR: Could not find a version that satisfies the requirement aalib (from versions: none)
Cleaning up...
Removed build tracker: '/tmp/pip-req-tracker-ygwnj94r'
ERROR: No matching distribution found for aalib
Exception information:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 357, in run
resolver.resolve(requirement_set)
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 281, in _get_abstract_dist_for
req.populate_link(self.finder, upgrade_allowed, require_hashes)
File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 249, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 926, in find_requirement
raise DistributionNotFound(
pip._internal.exceptions.DistributionNotFound: No matching distribution found for aalib
From above log, there is pretty obvious the URL https://pypi.org/simple/aalib/ 404 not found. Then you can guess the possible reasons which cause that 404, i.e. wrong package name. Another thing is I can modify relevant python files of pip modules to further debug with above log. To edit .whl file, you can use wheel command to unpack and pack.
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
Below command worked for me -
python -m pip install flask
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:
If I try to pip install getpass I get the following error:
"Could not find a version that satisfies the requirement getpass"
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.
If you facing this issue at the workplace. This might be the solution for you.
pip install -U <package_name> --user --proxy=<your proxy>
Pip install from pypi.org.
pip install -U -i https://pypi.org/simple package
One possible error, pip package requires python intepreter which you are not using.
I ran into the same problem, it occurred only when I ran commands from my Docker image (or Dockerfile). Finally many hours later I managed to solve it by updating my python intepreter. Pointed out that my pip-package required python>=3,7 but my Docker image was using python 3.6.
Tip: To check out if you have similar problem, just check pip package requirements and your python version. Private pip package intepreter requirements are wrote down inside setup.py or setup.cfg. Public pip packages are usuially hosted in pypi.org where you can just check intepreter requirements with your browser. To check your python intepreter version just write for example python --version or python3 --version in your console
General problem description
As other answers point out there can also be other requirements that you are not satisfying and that is why pip can not found suitable package version for you. All the requirements are wrote down in pip package documentation and can be easily readed from https://pypi.org/project/graphene-django/your-package
I got this error while installing awscli on Windows 10 in anaconda (python 3.7).
While troubleshooting, I went to the answer https://stackoverflow.com/a/49991357/6862405 and then to https://stackoverflow.com/a/54582701/6862405. Finally found that I need to install the libraries PyOpenSSL, cryptography, enum34, idna and ipaddress. After installing these (using simply pip install command), I was able to install awscli.
When I lost my internet connection, I had this error.
Since it's a pretty annoying problem that may stuck beginners for a long period of time, here I write a complete guild.
if you are running pip install PACKAGE or python -m pip install PACKAGE, and a no matching version found error reported, here's how to solve the problem.
search your package on browser, for example my package is pycypto, here I search pycypto pypi
find your package, open the link on pypi, click download file
open a python shell, import any of your installed package, for example, I have installed Pillow before.
>>> import PIL
>>> PIL.__path__
['/Applications/MAMP/htdocs/canvas/src/zzd/env/lib/python3.7/site-packages/PIL']
PACKAGE.__path__ function will gives you the side packages path where all packages should go into.
PLUS:
if you have no idea what packages you installed before, run pip list to get a list of installed packages.
after we obtain the path, open a shell, cd to the path
cd /Applications/MAMP/htdocs/canvas/src/zzd/env/lib/python3.7/site-packages/
open
unzip the downloaded file, drag it into site-packages.
cd into the downloaded directory, and run setup.py to install
cd pycrypto-2.6.1
python setup.py install
Then you should be able to import and use the package in python.
Same error in slightly different circumstances, on MacOs. Apparently setuptools versions past 45 can expose some issues and this command got me past it:
pip3 install setuptools==45
If the package is local, don't miss the relative path.
E.g.
pip install ./<pkg>
finally worked in my case, while
pip install <pkg>
yielded:
ERROR: Could not find a version that satisfies the requirement <pkg> (from versions: none)
ERROR: No matching distribution found for <pkg>
I had a problem installing pandas-1.4.3, and the problem was my python patch version. pandas-1.4.3 required python version 3.8.13 and did not work with 3.8.9:
python install -r requirements.txt # or pip install pandas==1.4.3
# -> Could not find a version that satisfies...
conda activate my_project # creates a virtual env for a new python version
conda install python=3.8.13 # installing the new python version
python --version # displays 3.8.13
pip install -r python/requirements.txt
# -> pandas installed as expected
Search in google if you find some other version of that package available
use that for example
I was getting errors using the glob so I used glob2 instead

Categories

Resources