question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import main from pip 18.0

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
abhiTronixcommented, Sep 12, 2018

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

2reactions
pradyunsgcommented, Jul 30, 2018

Please see #5599.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error after upgrading pip: cannot import name 'main'
You can resolve this issue by reinstalling pip. Use one of the following command line commands to reinstall pip:.
Read more >
ImportError cannot import name main in pip - Edureka
Hi Guys, I am getting this below error, when I am trying to install numpy in my system. $ pip3 ... import name...
Read more >
[SOLVED] Error after upgrading pip: cannot import name 'main'
This error mostly occurs when you have accidentally upgraded the pip in our system. · It appears when pip and unpack_url are used...
Read more >
[Solved] pip Import Error: cannot import name main
First, we need to fix the "pip3" file. Be careful! the suffix of "__main__. _main()" is "_main()" not "main()"!
Read more >
How to solve ImportError: cannot import name 'main'
When I upgrade pip3 by typing sudo pip3 install -U pip and use the upgraded one, I get an error message ' ImportError:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found