1

In Debian Stretch, when I try to install the python package python-constraint via

pip install python-constraint

I get the following error;

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1178, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 292, in find_requirement
    elif is_prerelease(version) and not (self.allow_all_prereleases or req.prereleases):
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 739, in is_prerelease
    return any([any([y in set(["a", "b", "c", "rc", "dev"]) for y in x]) for x in parsed])
TypeError: 'int' object is not iterable

Storing debug log for failure in /home/von/.pip/pip.log

In Debian Jessie the same command is sucessful.

Where is the problem? How to solve it?

$python --version
Python 2.7.9

$pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)
6

The error is related to the bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786580

The solution is to downgrade python-distlib and python-distlib-whl to the jessie version.

wget http://ftp.debian.org/debian/pool/main/d/distlib/python-distlib_0.1.9-1_all.deb
wget http://ftp.debian.org/debian/pool/main/d/distlib/python-distlib-whl_0.1.9-1_all.deb
dpkg -i python-distlib_0.1.9-1_all.deb 
dpkg -i python-distlib-whl_0.1.9-1_all.deb 

After that running pip install is sucessful.

$ sudo pip install python-constraint
Downloading/unpacking python-constraint
  Downloading python-constraint-1.2.tar.bz2
  Running setup.py (path:/tmp/pip-build-JeOIzg/python-constraint/setup.py) egg_info for package python-constraint

Installing collected packages: python-constraint
  Running setup.py install for python-constraint

Successfully installed python-constraint
Cleaning up...

Put the packages on hold, and wait for an official bug fix.

sudo aptitude hold python-distlib python-distlib-whl
  • you're right. I had the same problem two days ago. And your answer was also my solution. Vote up for you. – Willian Paixao May 28 '15 at 20:22
0

I ran into this on Raspbian trying to install a different package, and pip couldn't update itself due to the same error. Upgrading pip using apt-get solved it:

sudo apt-get install python3-pip

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.