3

How to fix this issue? and how to install pip and virtualenv on ubuntu 15.04

 pip install virtualenv
    Traceback (most recent call last):
      File "/usr/bin/pip", line 9, in <module>
        load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 521, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2632, in load_entry_point
        return ep.load()
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2312, in load
        return self.resolve()
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2318, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
        from pip.vcs import git, mercurial, subversion, bazaar  # noqa
      File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
        from pip.download import path_to_url
      File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
        from requests.compat import IncompleteRead
    ImportError: cannot import name IncompleteRead
2

Did you recently install the latest version of the python-package requests?

That one is incompatible with the old pip version shipped with Ubuntu!

You need to reinstall the current version of pip and everything will be fine:

sudo easy_install pip

Or if you have those issues with Python3:

sudo easy_install3 pip

You should always keep your python packages up to date with the current versions from PyPI (using pip or its ancestor easy_install while pip is broken) instead of using apt-get, as the Ubuntu repositories are pretty much behind the state of art.

Use sudo pip install --upgrade INSERTNAMEOFPYTHONPACKAGEHERE for every package you use to get an up-to-date environment.

  • omg thx for response :D anyway what easy_install is? where did they came from? i never install them (sudo apt-get install easy_install), but when i copy and paste that line work like charm – Ivan Jul 16 '15 at 12:21
  • easy_install is a part of your python installation, like pip. It's located in the python package setuptools, which is represented by the Ubuntu package python-setuptools (probably outdated though), if you install it with apt-get. easy_install's purpose is like pip's to install python packages. It is older than pip and differs in some features, but for the daily use, pip is better. I just use easy_install where pip does not work, e.g. here because it's broken. – Byte Commander Jul 16 '15 at 12:26
  • you mean by that easy_install is set by default on ubuntu? if pip i think must do "sudo apt-get install python-pip" first that we can use pip. i just wondering why that easy_install works like charm :D – Ivan Jul 16 '15 at 12:31
  • Not sure, I thought pip is installed by default, too... It is just that the newest version of python's requests removes the IncompleteRead package on which the old pip version from the Ubuntu repositories still relies. That is why pip fails, but easy_install does not depend on this old package, so it still works and allows you to easily get the newes tpip version that is not depending on the removed package any more. – Byte Commander Jul 16 '15 at 13:08
  • Mmh! I learnt something! – Fabby Aug 3 '15 at 20:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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