Skip to content

Instantly share code, notes, and snippets.

@rvteja92
Last active June 8, 2016 15:04
Show Gist options
  • Save rvteja92/e0c7983eec4eea18cbeadac5afbb9a87 to your computer and use it in GitHub Desktop.
Save rvteja92/e0c7983eec4eea18cbeadac5afbb9a87 to your computer and use it in GitHub Desktop.
Pip3 freeze ASSERTION ERROR
'''
The defualt pip3 installation in Ubuntu 14.04 (pip 1.5.4) seems to have a bug.
It gave an Assertion Error like this
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/freeze.py", line 74, in run
req = pip.FrozenRequirement.from_dist(dist, dependency_links, find_tags=find_tags)
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 286, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError
Storing debug log for failure in /tmp/tmp138cvxd_
'''
# To solve this issue, edit the file shown in error '/usr/lib/python3/dist-packages/pip/__init__.py'
# Change the line 286 (could be different for you) from
assert len(specs) == 1 and specs[0][0] == '=='
# To
assert len(specs) == 1 and specs[0][0] in ['==', '===']
# This error does not occur in a virtual environment
'''
Note: This is not my creation. I have found this bug fix at
https://github.com/pypa/pip/commit/6cab71f422f2425b4d2283023c9e955f9663dde6
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment