Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip: no module named _internal

Tags:

python

pip

I have a problem when I try to use pip in any way. I'm using Ubuntu 16.04.4

I should say that I've used it already, and I never had any problem, but starting today when I use any command I always get the same error (as an example using pip --upgrade).

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal

I have tried doing sudo apt-get remove python-pip followed by sudo apt-get install python-pip but nothing changed.

like image 992
Grimdrem Avatar asked Oct 05 '22 08:10

Grimdrem


People also ask

How do I fix No module named pip?

The Python "ModuleNotFoundError: No module named 'pip'" occurs when pip is not installed in our Python environment. To solve the error, install the module by running the python -m ensurepip --upgrade command on Linux or MacOS or py -m ensurepip --upgrade on Windows.

How do I fix usr bin python3 No module named pip?

While this error can come due to multiple reasons but in most of the cases you will see this error because of pip package not installed in your System. So to solve this kind of error, you need to simply install pip package from the default Repo.


2 Answers

This did it for me:

python -m pip install --upgrade pip

Environment: OSX && Python installed via brew

like image 197
magicrebirth Avatar answered Oct 18 '22 19:10

magicrebirth


An answer from askUbuntu works.

For pip2.7, you can at first curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py, then python2.7 get-pip.py --force-reinstall to reinstall pip.

Problem solved. Also works for python3.

like image 85
chris Avatar answered Oct 18 '22 21:10

chris