Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipenv-Error: ModuleNotFoundError: No module named 'pip._internal'

Today, I installed Pipenv via

pip install pipenv

As mentioned in the documentation I went to a test directory and created a new virtual environment using

pipenv shell

and tried to install a package via

pipenv install numpy

I got the following error message:

Installing numpy…
⠧
Error:  An error occurred while installing numpy!
Traceback (most recent call last):
  File "/Users/florian/.local/share/virtualenvs/test-bJfQ6Jzk/bin/pip", line 7, in <module>
    from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'

This error occurs even after reinstalling pipenv, deleting all files and recreate the environment. It also had no impact if I ran pipenv install numpy inside or outside the environment.

Python 3.6.3
Pipenv 11.10.1

Thank you in advance.

like image 877
Train Avatar asked May 02 '18 13:05

Train


People also ask

How do I fix ModuleNotFoundError 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 python2 No module named pip?

To fix the error with python -m pip If you get a Python 2 version, try python3 --version . If you don't get errors (and receive a Python 3 version), replace python -m pip with python3 -m pip . That should fix your No module named pip issue.

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.


1 Answers

I have had the same issue (python 3.5/Ubuntu 16.04LTS). Reinstalling pip with:

sudo apt install python-pip python-pip3 --reinstall

didn't solve the issue with me.

What worked in my case was reinstalling pipenv itself, from pip:

sudo pip3 install pipenv --force-reinstall

If you are running python 2.x or if your system is different than mine, you can try to replace pip3 with pip in the command:

sudo pip install pipenv --force-reinstall
like image 187
cedbeu Avatar answered Sep 28 '22 08:09

cedbeu