I worked on some python projects lately and had lots of problems with pip
not installing the latest versions of some requirements. I am on osx
and and I used brew to install Python 2.7.6
. In the project I'm working on, we simply install requirements like this:
pip install -r requirements.txt
In the current case, I needed to install argparse==1.2.1
. This is the actual latest version shown on the pypi website
Here's my output
Downloading/unpacking argparse==1.2.1 (from -r requirements.txt (line 4))
Could not find a version that satisfies the requirement argparse==1.2.1 (from -r requirements.txt (line 4)) (from versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 0.9.0, 0.9.1, 1.0.1, 1.0, 1.1)
Some externally hosted files were ignored (use --allow-external to allow).
Cleaning up...
No distributions matching the version for argparse==1.2.1 (from -r requirements.txt (line 4))
I had similar problems with different kinds of requirements such as matplotlib
which I installed manually as seen here.
As you can see, pip on my mac only has those argparse versions: 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 0.9.0, 0.9.1, 1.0.1, 1.0, 1.1
I tried reinstalling python with brew reinstall python
, then also tried to reinstall all of my installed python packages with some xargs
magic:
pip freeze | xargs -I {} pip install {} --upgrade --force-reinstall
While trying to reinstall everything, I had trouble with most of the packages: error: invalid command 'egg_info'
. I figured out I had an old setuptools
so I ran this to upgrade:
pip install --upgrade setuptools
and I could now reinstall everything, but still, same problem with argparse
.
I asked a friend with a freshly installed osx to pip install argparse
and he got 1.1
So I've setup a precise32
vagrant box for a clean ubuntu install with python-dev
+ libevent-dev
and had no trouble at all installing argparse==1.2.1
.
To continue working on the project, I installed argparse 1.1 on macOS and it seems to work fine at the moment for what I'm working on.
Is-there any reason why I'm not getting the latest versions shown on pypi?
Sounds like not all the libs on pypi are available for osx.
Is there a way to know version availability for different os?
I think this line is the key:
Some externally hosted files were ignored (use --allow-external to allow).
When I install argparse here I get
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
Downloading argparse-1.2.1.tar.gz (69kB): 69kB downloaded
So you have a newer version of pip that is disallowing externally hosted files by default