Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip list crashes with an AssertionError

Tags:

python

list

pip

What might be the problem below? It looks like there is a bug in pip. I installed pip yesterday using brew. Prior to that, I had installed most python packages with $ python setup.py install

steves-MacBook-Pro:server steve$ pip -V
pip 1.4.1 from /Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg (python 2.7)
steves-MacBook-Pro:server steve$ pip list
altgraph (0.9)
bdist-mpkg (0.4.4)
... 
...(a bunch of python packages omitted here for brevity)
...
...
requests (2.0.0)
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/commands/list.py", line 80, in run
    self.run_listing(options)
  File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/commands/list.py", line 127, in run_listing
    self.output_package_listing(installed_packages)
  File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/commands/list.py", line 136, in output_package_listing
    if dist_is_editable(dist):
  File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/util.py", line 347, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/Library/Python/2.7/site-packages/pip-1.4.1-py2.7.egg/pip/__init__.py", line 194, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError
like image 852
user1416227 Avatar asked Oct 18 '13 22:10

user1416227


2 Answers

Using modern Ubuntu, I had the same problem and was able to fix it using the instructions in this comment.

The problem, as I understand it, is that pip as provided by Ubuntu is old, and also cannot update itself (since it's managed by apt, not pip). One solution is to remove the Ubuntu version of pip and install the latest.

In short:

sudo apt-get remove python-pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

This will install pip to /usr/local/bin, so you'll want to add that to your path.

like image 92
David Avatar answered Oct 30 '22 02:10

David


This can be caused by an old version of pip.

Make sure your setuptools and pip are up to date:

sudo pip install --upgrade setuptools
sudo pip install --upgrade pip
like image 44
raittes Avatar answered Oct 30 '22 03:10

raittes