Pip: Cannot import main from pip 18.0

Created on 30 Jul 2018  路  6Comments  路  Source: pypa/pip

Environment: Global Environment

  • pip version: 18.0
  • Python version: 3
  • OS: Ubuntu 17.10 (Linux)

Description
When upgraded from 9.0.3 to 18.0, it starts showing the following error constantly on each use of pip-

Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main

Expected behavior
This should not be happen.

How to Reproduce
Upgrade pip from version 9 to latest as
pip install --upgrade pip
and you are unable to use any features of pip anymore.

  1. Get package from this link https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl.
  2. Then try run e.g.
    pip install scikit-learn
  3. ImportError occurs.

Output
Following traceback:

Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main

Most helpful comment

The Ubuntu's python-pip-9.0.1 installed(via apt get python-pip) is conflicting with Latest pip-18.0 provided by pypa. So sudo rm -rf ~/.local/lib/python2.7/site-packages/(Beware!) removes the ubuntu's python-pip and resolves the problem. _Only one pip can exist on the system_

All 6 comments

Please see #5599.

Thanks. @pradyunsg

The Ubuntu's python-pip-9.0.1 installed(via apt get python-pip) is conflicting with Latest pip-18.0 provided by pypa. So sudo rm -rf ~/.local/lib/python2.7/site-packages/(Beware!) removes the ubuntu's python-pip and resolves the problem. _Only one pip can exist on the system_

I couldn't find python-pip in site-packages

I couldn't find python-pip in site-packages

rm -rf ~/.local/lib/python*

Please see #5599, there's a lot of advice presented there.

Was this page helpful?
0 / 5 - 0 ratings