Skip to content

Instantly share code, notes, and snippets.

@egor83
Created July 2, 2021 08:22
Show Gist options
  • Save egor83/c5db6f580883994abae7f535ba83a918 to your computer and use it in GitHub Desktop.
Save egor83/c5db6f580883994abae7f535ba83a918 to your computer and use it in GitHub Desktop.
Solving ModuleNotFoundError: No module named 'pip._vendor.six' with pyenv and pipenv
I got an error `ModuleNotFoundError: No module named 'pip._vendor.six'` after trying to run `pipenv install` on a new project.
At first I tried using the solution described here:
https://github.com/pypa/pip/issues/6261#issuecomment-471438784
I was using pyenv, so I did the following:
```
rm -rf /home/user/.pyenv/versions/3.7.5/lib/python3.7/site-packages/pip
# I also had to remove second pip directory, named something like pip-X.Y.Z.dist-info
python -m ensurepip
pip install --upgrade pip
```
Then I got an error `ModuleNotFoundError: No module named 'pip._internal.cli.main'`
Running `python -m pip install --upgrade pip` did not help.
Then I noticed that error logs mention pipenv's installation, not pyenv's one, so I did the following:
```
pipenv --rm
pipenv --python 3.7.5
# deleted both pip-related directories from pipenv virtual env,
/home/user/.local/share/virtualenvs/dir_name-FnxKOSDE/lib/python3.7/site-packages/pip
/home/user/.local/share/virtualenvs/dir_name-FnxKOSDE/lib/python3.7/site-packages/pip-X.Y.Z.dist-info
# then I ran this to update pipenv's pip
pipenv run python -m ensurepip
pipenv run python -m pip install --upgrade pip
pipenv install --dev
```
And this worked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment