Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does `pip install hwrt --upgrade` upgrade to a random version (sometimes also downgrade)?

Tags:

python

pypi

I've just executed

$ sudo pip install hwrt --upgrade

to install the latest version of my Python package hwrt. I've added the possibility to get the package version with hwrt --version. Now I get this strange behavior:

$ hwrt --version
hwrt 0.1.201
$ sudo pip install hwrt --upgrade
[... some output ...]
$ hwrt --version
hwrt 0.1.203
$ sudo pip install hwrt --upgrade
[... some output ...]
$ hwrt --version
hwrt 0.1.205
$ sudo pip install hwrt --upgrade
[... some output ...]
$ hwrt --version
hwrt 0.1.200

What is happening here?

I have pip 6.0.7 from /usr/local/lib/python2.7/dist-packages (python 2.7)

Verbose

I've just ran sudo pip install hwrt --upgrade --verbose > install.log.

The full log is here: http://pastebin.com/eZ9M9UVd

The following seems to be interesting:

[...]
Using version 0.1.211 (<-this is the version it should be)[...]
[...]
Collecting hwrt from https://pypi.python.org/packages/source/h/hwrt/hwrt-0.1.211.tar.gz#md5=b75ac2f4c644743cfa865f086163a93e
  "GET /packages/source/h/hwrt/hwrt-0.1.211.tar.gz HTTP/1.1" 200 2228910
  Downloading hwrt-0.1.211.tar.gz (2.2MB)
  Downloading from URL https://pypi.python.org/packages/source/h/hwrt/hwrt-0.1.211.tar.gz#md5=b75ac2f4c644743cfa865f086163a93e
  Running setup.py (path:/tmp/pip-build-lWJUXg/hwrt/setup.py) egg_info for package hwrt
    Running command python setup.py egg_info
    running egg_info
    creating pip-egg-info/hwrt.egg-info
    writing requirements to pip-egg-info/hwrt.egg-info/requires.txt
    writing pip-egg-info/hwrt.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/hwrt.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/hwrt.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/hwrt.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/hwrt.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    no previously-included directories found matching 'docs/_build'
    writing manifest file 'pip-egg-info/hwrt.egg-info/SOURCES.txt'
  Source in /tmp/pip-build-lWJUXg/hwrt has version 0.1.211, which satisfies requirement hwrt from https://pypi.python.org/packages/source/h/hwrt/hwrt-0.1.211.tar.gz#md5=b75ac2f4c644743cfa865f086163a93e
[...]
Found existing installation: hwrt 0.1.204
Uninstalling hwrt-0.1.204:
[...]
Successfully installed argparse-1.2.1 hwrt-0.1.209
Cleaning up...
like image 764
Martin Thoma Avatar asked Feb 02 '15 16:02

Martin Thoma


1 Answers

While I can't answer the why that I think is your primary question, I can offer a solution to get around the problem if it's causing problems. The short version is just to specify exactly what version you want, e.g.:

trevor@nikola:~$ pip list --outdated | grep Django
Django (Current: 1.7.5 Latest: 1.7.6)
pip install -U Django==1.7.6

This is especially useful if you're creating something and you want to specify dependencies that remain static so you don't have to update your code if an underlying dependency changes.

Sometimes you're not sure which version is appropriate, such as knowing you need to use a version "before version X", but don't know the specific number to install. Pip can show you the available versions if you try to install an incorrect/non-existent version. For example:

trevor@nikola:~$ pip install Django==-1
Collecting Django==-1
  Could not find a version that satisfies the requirement Django==-1 
(from versions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 
... lots that I'm skipping ... 
1.6.8, 1.6.9, 1.6.10, 1.7, 1.7.1, 1.7.2, 1.7.3, 
1.7.4, 1.7.5, 1.7.6, 1.8a1, 1.8b1, 1.8b2)
  No distributions matching the version for Django==-1

So I know I need a pre-1.7 install, I can probably use 1.6.10.

like image 60
TCAllen07 Avatar answered Nov 05 '22 14:11

TCAllen07