Pip: Assertion Error with pip list

Created on 27 Jul 2013  ·  42Comments  ·  Source: pypa/pip

I experienced the following error after installing pip and attempting a:
pip list --outdated


C:\Python33\Scripts\pip-script.py run on 07/27/13 15:32:54
Exception:
Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\pip\basecommand.py", line 134, in main
    status = self.run(options, args)
  File "C:\Python33\lib\site-packages\pip\commands\list.py", line 74, in run
    self.run_outdated(options)
  File "C:\Python33\lib\site-packages\pip\commands\list.py", line 83, in run_outdated
    for dist, remote_version_raw, remote_version_parsed in self.find_packages_latests_versions(options):
  File "C:\Python33\lib\site-packages\pip\commands\list.py", line 104, in find_packages_latests_versions
    installed_packages = get_installed_distributions(local_only=options.local, include_editables=False, skip=self.skip)
  File "C:\Python33\lib\site-packages\pip\util.py", line 384, in get_installed_distributions
    return [d for d in pkg_resources.working_set
  File "C:\Python33\lib\site-packages\pip\util.py", line 387, in <listcomp>
    and editable_test(d)
  File "C:\Python33\lib\site-packages\pip\util.py", line 377, in <lambda>
    editable_test = lambda d: not dist_is_editable(d)
  File "C:\Python33\lib\site-packages\pip\util.py", line 347, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "C:\Python33\lib\site-packages\pip\__init__.py", line 194, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError
lisshow auto-locked bug

Most helpful comment

The issue is still there in _Ubuntu 15.04, pip 1.5.6, distribute-0.7.3_ (the pip upgrade of 'pip' or 'distribute' does not work, as the issue seems to be Ubuntu specific. See below).

The fix it:

  • to remove ubuntu package: sudo apt-get remove --auto-remove python-pip
  • download official pip installer: wget https://bootstrap.pypa.io/get-pip.py
  • install pip by running downloaded installer: sudo python get-pip.py
  • add sym-link to make it run without full path: sudo ln -s /usr/local/bin/pip /usr/bin/pip

Done!


The issue logs:

$ sudo pip install -U pip
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.1.1-py2.py3-none-any.whl#md5=172eb5abab25a5e0f7a7b63c7a49378d
  Downloading pip-6.1.1-py2.py3-none-any.whl (1.1MB): 1.1MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.6
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed pip
Cleaning up...

$ pip install --upgrade distribute
Downloading/unpacking distribute
  Downloading distribute-0.7.3.zip (145kB): 145kB downloaded
  Running setup.py (path:/tmp/pip-build-ZpdlMd/distribute/setup.py) egg_info for package distribute

Downloading/unpacking setuptools>=0.7 (from distribute)
  Downloading setuptools-16.0-py2.py3-none-any.whl (461kB): 461kB downloaded
Installing collected packages: setuptools, distribute
  Running setup.py install for distribute

Successfully installed setuptools distribute
Cleaning up...

$ pip list
aniso8601 (0.92)
...
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/list.py", line 80, in run
    self.run_listing(options)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 142, in run_listing
    self.output_package_listing(installed_packages)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 151, in output_package_listing
    if dist_is_editable(dist):
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 367, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 299, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

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

All 42 comments

It happens when you install distribute using http://python-distribute.org/distribute_setup.py script. Running pip install -U distribute fixes the problem. The bug reproduces only in pip==1.4. Here's why this line fails:

ipdb> specs
[]

Okay that fixed that problem but now I have a problem anytime I try to install a package or upgrade an outdated one.

I have upgraded distribute, which also upgrades setuptools.


C:\Python33\Scripts\pip-script.py run on 07/30/13 10:55:56
Downloading/unpacking openpyxl

  Getting page https://pypi.python.org/simple/openpyxl/
  URLs to search for versions for openpyxl:
  * https://pypi.python.org/simple/openpyxl/
  Analyzing links from page https://pypi.python.org/simple/openpyxl/
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.4.tar.gz#md5=1c7c750dc2a2fdb8fbdff06d626b0de6 (from https://pypi.python.org/simple/openpyxl/), version: 1.5.4
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.3.tar.gz#md5=dc0ab019f3d3b815c7b811df7b5ea64d (from https://pypi.python.org/simple/openpyxl/), version: 1.5.3
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.5.tar.gz#md5=b74d128eb8bd0df5cb66f0bf4ff581c8 (from https://pypi.python.org/simple/openpyxl/), version: 1.5.5
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.1.0.zip#md5=46eb03d68c15e29b0d7337c0c350f441 (from https://pypi.python.org/simple/openpyxl/), version: 1.1.0
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.2.tar.gz#md5=b9b733405607312c736811d1dac01119 (from https://pypi.python.org/simple/openpyxl/), version: 1.5.2
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.2.3.zip#md5=fd9104954b9b016d92ba5300cbd8a8a7 (from https://pypi.python.org/simple/openpyxl/), version: 1.2.3
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.1.7.zip#md5=37cd161925e34379a0a69a3732325f8b (from https://pypi.python.org/simple/openpyxl/), version: 1.1.7
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.1.5.tar.gz#md5=7da06c60291d888671c2b65be9978ca4 (from https://pypi.python.org/simple/openpyxl/), version: 1.1.5
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.1.6.zip#md5=a71d9715d102ae03b953a7c5005fabed (from https://pypi.python.org/simple/openpyxl/), version: 1.1.6
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.6.1.tar.gz#md5=d0d92b3b8128609be93a044ce3dac3f8 (from https://pypi.python.org/simple/openpyxl/), version: 1.6.1
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.0.tar.gz#md5=5d1a4a6c6747b9d4985211d4738f738d (from https://pypi.python.org/simple/openpyxl/), version: 1.5.0
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.1.tar.gz#md5=acc3c52c9f7340c71f226f840d11b0e7 (from https://pypi.python.org/simple/openpyxl/), version: 1.5.1
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.1.4.zip#md5=e56cfbffddf58fb7a97f43f02e0c931a (from https://pypi.python.org/simple/openpyxl/), version: 1.1.4
    Skipping link https://pypi.python.org/packages/2.6/o/openpyxl/openpyxl-1.1.0-py2.6.egg#md5=6e5740380a9829879b67816c71fc145e (from https://pypi.python.org/simple/openpyxl/); unknown archive format: .egg
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.8.tar.gz#md5=a267dd0dd0d4eb49908d7e9cd7a9ee30 (from https://pypi.python.org/simple/openpyxl/), version: 1.5.8
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.6.tar.gz#md5=6b080e13593e57b2e3241b5c242c0bdf (from https://pypi.python.org/simple/openpyxl/), version: 1.5.6
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.5.7.tar.gz#md5=ed1dbbb80878efb8e39e6cefba07bd17 (from https://pypi.python.org/simple/openpyxl/), version: 1.5.7
    Found link https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.6.2.tar.gz#md5=9f24ed772c98f24ae693f8ab6c7b7016 (from https://pypi.python.org/simple/openpyxl/), version: 1.6.2
  Using version 1.6.2 (newest of versions: 1.6.2, 1.6.1, 1.5.8, 1.5.7, 1.5.6, 1.5.5, 1.5.4, 1.5.3, 1.5.2, 1.5.1, 1.5.0, 1.2.3, 1.1.7, 1.1.6, 1.1.5, 1.1.4, 1.1.0)
  Downloading from URL https://pypi.python.org/packages/source/o/openpyxl/openpyxl-1.6.2.tar.gz#md5=9f24ed772c98f24ae693f8ab6c7b7016 (from https://pypi.python.org/simple/openpyxl/)
  Running setup.py egg_info for package openpyxl

    C:\Python33\lib\distutils\dist.py:257: UserWarning: Unknown distribution option: 'tests_require'

      warnings.warn(msg)

    C:\Python33\lib\distutils\dist.py:257: UserWarning: Unknown distribution option: 'test_suite'

      warnings.warn(msg)

    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: -c --help [cmd1 cmd2 ...]

       or: -c --help-commands

       or: -c cmd --help



    error: invalid command 'egg_info'

    Complete output from command python setup.py egg_info:

    C:\Python33\lib\distutils\dist.py:257: UserWarning: Unknown distribution option: 'tests_require'

  warnings.warn(msg)

C:\Python33\lib\distutils\dist.py:257: UserWarning: Unknown distribution option: 'test_suite'

  warnings.warn(msg)

usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

   or: -c --help [cmd1 cmd2 ...]

   or: -c --help-commands

   or: -c cmd --help



error: invalid command 'egg_info'

----------------------------------------

Cleaning up...

  Removing temporary dir c:\users\odhinn\appdata\local\temp\pip-build-Odhinn...
Command python setup.py egg_info failed with error code 1 in c:\users\odhinn\appdata\local\temp\pip-build-Odhinn\openpyxl

Exception information:
Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\pip\basecommand.py", line 134, in main
    status = self.run(options, args)
  File "C:\Python33\lib\site-packages\pip\commands\install.py", line 236, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python33\lib\site-packages\pip\req.py", line 1124, in prepare_files
    req_to_install.run_egg_info()
  File "C:\Python33\lib\site-packages\pip\req.py", line 257, in run_egg_info
    command_desc='python setup.py egg_info')
  File "C:\Python33\lib\site-packages\pip\util.py", line 670, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command python setup.py egg_info failed with error code 1 in 

Python 2.6.5
pip 1.4.1 from /usr/local/lib/python2.6/dist-packages (python 2.6)
distribute==0.7.3

error message:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/pip/basecommand.py", line 134, in main
status = self.run(options, args)
File "/usr/local/lib/python2.6/dist-packages/pip/commands/list.py", line 80, in run
self.run_listing(options)
File "/usr/local/lib/python2.6/dist-packages/pip/commands/list.py", line 127, in run_listing
self.output_package_listing(installed_packages)
File "/usr/local/lib/python2.6/dist-packages/pip/commands/list.py", line 136, in output_package_listing
if dist_is_editable(dist):
File "/usr/local/lib/python2.6/dist-packages/pip/util.py", line 347, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/usr/local/lib/python2.6/dist-packages/pip/init.py", line 194, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

but pip==1.3.1 is ok

I experienced the same error.

root@server ~ # pip list
distribute (0.6.14)
Fabric (1.7.0)
iotop (0.4)
MySQL-python (1.2.2)
paramiko (1.11.0)
PIL (1.1.7)
pip (1.4.1)
pycrypto (2.6)
python-memcached (1.45)
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/pip/basecommand.py", line 134, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.6/dist-packages/pip/commands/list.py", line 80, in run
    self.run_listing(options)
  File "/usr/local/lib/python2.6/dist-packages/pip/commands/list.py", line 127, in run_listing
    self.output_package_listing(installed_packages)
  File "/usr/local/lib/python2.6/dist-packages/pip/commands/list.py", line 136, in output_package_listing
    if dist_is_editable(dist):
  File "/usr/local/lib/python2.6/dist-packages/pip/util.py", line 347, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/usr/local/lib/python2.6/dist-packages/pip/__init__.py", line 194, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

Upgrading distribute worked, thanks!

Experienced the same problem, upgrading distribute worked for me as well.

More thx for the pip install -U distribute

After experiencing the AssertionError with pip list, the suggested fix pip install -U distribute errors out with message "requires setuptools >= 0.8 for dist-info support". Usage and logs below. Would a pip install -U setuptools be appropriate? I fear trying it out myself because I'm not very experienced with pip and the dependency management. Thanks!

timrdf@opendap:~/projects/opendap$ pip list
BeautifulSoup (3.2.1)
ckanclient (0.10)
distribute (0.6.10)
faqt (0.0.2)
html5lib (1.0b3)
isodate (0.4.9)
mod-python (3.3.1)
ordereddict (1.1)
pip (1.5)
pyparsing (1.5.7)
python-apt (0.7.94.2ubuntu6.4)
rdfextras (0.4)
rdflib (3.2.1)
sadi (0.1.5)
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/commands/list.py", line 80, in run
    self.run_listing(options)
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/commands/list.py", line 142, in run_listing
    self.output_package_listing(installed_packages)
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/commands/list.py", line 151, in output_package_listing
    if dist_is_editable(dist):
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/util.py", line 347, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/__init__.py", line 231, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

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



timrdf@opendap:~/projects/opendap$ sudo pip install -U distribute
Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Storing debug log for failure in /home/timrdf/.pip/pip.log



timrdf@opendap:~/projects/opendap$ cat /home/timrdf/.pip/pip.log
------------------------------------------------------------
/usr/local/bin/pip run on Tue Jan 21 17:10:05 2014
Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Exception information:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/commands/install.py", line 230, in run
    finder = self._build_package_finder(options, index_urls, session)
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/commands/install.py", line 185, in _build_package_finder
    session=session,
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/index.py", line 50, in __init__
    self.use_wheel = use_wheel
  File "/usr/local/lib/python2.6/dist-packages/pip-1.5-py2.6.egg/pip/index.py", line 89, in use_wheel
    raise InstallationError("pip's wheel support requires setuptools >= 0.8 for dist-info support.")
InstallationError: pip's wheel support requires setuptools >= 0.8 for dist-info support.

Just hit this on the latest Linux Mint (16) with the packaged version of pip (1.4.1) by running simply pip list. This issue seems quite old and there seems to be no attempt to fix it. Is this correct? If so, I might have a crack at it if I have some spare time.

I have also run into this on Lubuntu (14.04 LTS) using pip==1.5.4. However upgrading distribute worked for me!

@jetheurer can you say what version of distribute you were using when you encountered the bug?

This should be the latest setuptools package you should be using http://packages.ubuntu.com/trusty/python-setuptools and hopefully nothing that calls itself distribute (distribute has been replaced by setuptools now).

@Ivoz I am currently using distribute==0.7.3, using Python 2.7.6. It seems I have setuptools==0.6c11 installed as well

@jetheurer I am not sure how you have managed to get such old versions while using 14.04. I'd suspect the old versions might be causing you the error. Trusty should normally be setuptools 3.3

Distribute was merged into setuptools a while ago now; as such you generally want to use a recent version of setuptools (almost anything above version 1.0 should work!). Latest version you can see here.

Try to uninstall everything distribute / setuptools (double check!) and then reinstall a newer version would be my suggested course of action.

I've installed pip with sudo apt-get install python-pip, but even with latest pip, distribute and setuptools I still had AssertionError when using pip list or pip freeze in Ubuntu 14.10. Command sudo apt-get install python-pip also installs dependencies: python-colorama, python-distlib, python-html5lib, python-requests and python-wheel . I think some of these modules are giving me AssertionError, so I've uninstalled pip with all dependencies with sudo apt-get remove --auto-remove python-pip, and then just pip with sudo easy_install pip. Only this way works for me.

I follow @arktrin 's comment and this is solved.
the below is the log.

  • before
~@cherry-com(7875)$ pip list
adium-theme-ubuntu (0.3.4)
apt-xapian-index (0.45)
argparse (1.2.1)
boto (2.38.0)
bz2file (0.98)
chardet (2.3.0)
colorama (0.2.5)
command-not-found (0.3)
 ....................................
pyserial (2.6)
pysmbc (1.0.14.1)
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/list.py", line 80, in run
    self.run_listing(options)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 142, in run_listing
    self.output_package_listing(installed_packages)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 151, in output_package_listing
    if dist_is_editable(dist):
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 348, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 236, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

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

  • after
~@cherry-com(7878)$ sudo apt-get remove --auto-remove python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  python-colorama python-distlib python-html5lib python-pip
0 upgraded, 0 newly installed, 4 to remove and 207 not upgraded.
After this operation, 1,682 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 223180 files and directories currently installed.)
Removing python-pip (1.5.4-1) ...
Removing python-colorama (0.2.5-0.1ubuntu1) ...
Removing python-distlib (0.1.8-1) ...
Removing python-html5lib (0.999-2) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
~@cherry-com(7879)$ sudo easy_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 6.1.1
Downloading https://pypi.python.org/packages/source/p/pip/pip-6.1.1.tar.gz#md5=6b19e0a934d982a5a4b798e957cb6d45
Processing pip-6.1.1.tar.gz
Writing /tmp/easy_install-MTjyCd/pip-6.1.1/setup.cfg
Running pip-6.1.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-MTjyCd/pip-6.1.1/egg-dist-tmp-1x05jK
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.mailmap'
warning: no previously-included files found matching '.travis.yml'
warning: no previously-included files found matching 'pip/_vendor/Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching 'dev-requirements.txt'
no previously-included directories found matching '.travis'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'contrib'
no previously-included directories found matching 'tasks'
no previously-included directories found matching 'tests'
creating /usr/local/lib/python2.7/dist-packages/pip-6.1.1-py2.7.egg
Extracting pip-6.1.1-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding pip 6.1.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/pip-6.1.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
~@cherry-com(7880)$ pip freeze
-bash: /usr/bin/pip: No such file or directory
~@cherry-com(7884)$ /usr/local/bin/pip freeze
/usr/local/lib/python2.7/dist-packages/pip-6.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
adium-theme-ubuntu==0.3.4
apt-xapian-index==0.45
boto==2.38.0
bz2file==0.98
chardet==2.3.0

..............................

Twisted-Web==13.2.0
unity-lens-photos==1.0
urllib3==1.7.1
Werkzeug==0.10.4
xdiagnose===3.6.3build2
zope.interface==4.0.5
~@cherry-com(7885)$

The issue is still there in _Ubuntu 15.04, pip 1.5.6, distribute-0.7.3_ (the pip upgrade of 'pip' or 'distribute' does not work, as the issue seems to be Ubuntu specific. See below).

The fix it:

  • to remove ubuntu package: sudo apt-get remove --auto-remove python-pip
  • download official pip installer: wget https://bootstrap.pypa.io/get-pip.py
  • install pip by running downloaded installer: sudo python get-pip.py
  • add sym-link to make it run without full path: sudo ln -s /usr/local/bin/pip /usr/bin/pip

Done!


The issue logs:

$ sudo pip install -U pip
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-6.1.1-py2.py3-none-any.whl#md5=172eb5abab25a5e0f7a7b63c7a49378d
  Downloading pip-6.1.1-py2.py3-none-any.whl (1.1MB): 1.1MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.6
    Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS
Successfully installed pip
Cleaning up...

$ pip install --upgrade distribute
Downloading/unpacking distribute
  Downloading distribute-0.7.3.zip (145kB): 145kB downloaded
  Running setup.py (path:/tmp/pip-build-ZpdlMd/distribute/setup.py) egg_info for package distribute

Downloading/unpacking setuptools>=0.7 (from distribute)
  Downloading setuptools-16.0-py2.py3-none-any.whl (461kB): 461kB downloaded
Installing collected packages: setuptools, distribute
  Running setup.py install for distribute

Successfully installed setuptools distribute
Cleaning up...

$ pip list
aniso8601 (0.92)
...
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/list.py", line 80, in run
    self.run_listing(options)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 142, in run_listing
    self.output_package_listing(installed_packages)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 151, in output_package_listing
    if dist_is_editable(dist):
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 367, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 299, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

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

@UzLA Thanks! This works for me too on Kubuntu 15.04. I built a salt state for this.

@UzLA +1 for this. Once I had removed the ubuntu package, I used easy_install instead of downloading the official installer, but to the same effect :)

@UzLA thanks, that did the trick for me too on Lubuntu 15.04/pip 7.1.0/python 2.7.9.

@UzLA , Just want to confirm this worked for me, thanks.

The issue seems to come from the obsolete distribute combined with an old pip version.
It can certainly be closed.

Plus, the AssertionError is now clearer in latest versions since it now prints the offending dist (https://github.com/pypa/pip/blob/develop/pip/__init__.py#L262-L264)
Related to #1346.

FWIW: I patched my locally installed pip pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7) to show me the offending dist.

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/list.py", line 80, in run
    self.run_listing(options)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 142, in run_listing
    self.output_package_listing(installed_packages)
  File "/usr/lib/python2.7/dist-packages/pip/commands/list.py", line 151, in output_package_listing
    if dist_is_editable(dist):
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 367, in dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 299, in from_dist
    assert len(specs) == 1 and specs[0][0] == '==', (dist, req, specs)
AssertionError: (python-apt 0.9.3.11build1 (/usr/lib/python2.7/dist-packages), Requirement.parse('python-apt===0.9.3.11build1'), [('===', '0.9.3.11build1')])

https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/1489443

@arktrin 's method work for me in Ubuntu 15.04

@arktrin 's method works for me too.

pip install through apt-get installs a very old version. If you install a newer version of pip using easy_install u won't get this error.

sudo easy_install pip updated my pip version from 1.5.4 to 7.1.2 and now pip works fine for me..

U might also want to update setuptools sudo pip install setuptools==7.0

this worked for me

@kumardadi Worked for me as well.

The pip package maintainers should really get a newer version into the Ubuntu and Debian package repos.

We have no control over what version of pip Ubuntu and Debian ship. If you want a newer version in those repositories you'll need to contact Ubuntu and Debian and ask them for it.

@dstufft Got any links or mailing lists I can use to contact them?

https://lists.debian.org/debian-python/ Is their mailing list, but I don't actually suspect they'll upgrade the already released versions of Debian/Ubuntu. Unfortunately there isn't much we can do :(

A medium priority bug report about upgrading pip has been filed in Ubuntu's launchpad: https://bugs.launchpad.net/pip/+bug/1445947

The bug was posted on 2015-04-19, but is yet to be assigned... if we're lucky, we might get it in Ubuntu 16.04.

I got the following error:

Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run
    root=options.root_path,
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 646, in install
    **kwargs
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 803, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 998, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 339, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 310, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 71, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/urllib3-1.12.dist-info'

What to do next?

@shruti927

I got the following error:

Doing what ?

This seems completely unrelated to this issue, so open a new one ?
But this looks like a simple permission issue ? Maybe you should be using --user or sudo ?

Run 'sudo pip list'
Permission is denied as you didn't run the command as root user


From: shruti927mailto:[email protected]
Sent: ‎03-‎12-‎2015 01:49
To: pypa/pipmailto:[email protected]
Cc: kumardadimailto:[email protected]
Subject: Re: [pip] Assertion Error with pip list (#1093)

I got the following error:

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 646, in install
kwargs
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 310, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/utils/
init**.py", line 71, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/urllib3-1.12.dist-info'

What to do next?


Reply to this email directly or view it on GitHub:
https://github.com/pypa/pip/issues/1093#issuecomment-161421612

@kumardadi I tried running the command you told and then I got this error:

The directory '/home/shrutika/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag

What is sudo's -H flag and what should I do next?

Run 'sudo -H pip list' this will solve
-H is for overriding cache permissions


From: shruti927mailto:[email protected]
Sent: ‎03-‎12-‎2015 10:16
To: pypa/pipmailto:[email protected]
Cc: kumardadimailto:[email protected]
Subject: Re: [pip] Assertion Error with pip list (#1093)

@kumardadi I tried running the command you told and then I got this error:

The directory '/home/shrutika/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag

What is sudo's -H flag and what should I do next?


Reply to this email directly or view it on GitHub:
https://github.com/pypa/pip/issues/1093#issuecomment-161513113

@kumardadi I am still getting this:

/usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning

@shruti927 what version of pip are you using?

pip-7.1.2 and python 2.7.6

Thanks, @UzLA , your solution works for me!

@UzLA Thanks, it worked for me

Good.

how can help me to fix this issue on freebsd, what am I doing wrong?
I hope you can help me. please help

root@SickRage:~ # service sickrage start
sickrage_user: _sabnzbd -> _sabnzbd
sickrage_group: _sabnzbd -> _sabnzbd
sickrage_enable: YES -> YES
sickrage_user: _sabnzbd -> _sabnzbd
sickrage_group: _sabnzbd -> _sabnzbd
sickrage_enable: YES -> YES
Starting sickrage.
Traceback (most recent call last):
  File "/usr/local/sickrage/sickrage/__init__.py", line 208, in main
    from sickrage import core
  File "/usr/local/sickrage/sickrage/core/__init__.py", line 34, in <module>
    from apscheduler.schedulers.tornado import TornadoScheduler
ImportError: No module named apscheduler.schedulers.tornado
Failed to import required libs, please run 'pip install -r /usr/local/sickrage/requirements.txt' from console

@gillymoreno this seems like the wrong place to report the issue, you should directly check with the sickrage developers.

Was this page helpful?
0 / 5 - 0 ratings