Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Error after upgrading pip: cannot import name 'main'

Asked by Shukhdev Singh Jun 3, 2021 1.7K views 1 answer
Share

About this question

Whenever I am trying to install any package using pip, I am getting this import error”cannot import name main pip”:

guru@guru-notebook:~$ pip3 install numpy
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in
from pip import main
ImportError: cannot import name 'main'
guru@guru-notebook:~$ cat `which pip3`
#!/usr/bin/python3
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
     sys.exit(main())

It was working fine earlier, I am not sure why it is throwing this error. I have searched about this error, but can't find anything to fix it.

Please let me know if you need any further detail, I will update my question.

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.