pipenv: ModuleNotFoundError: No module named 'pip._vendor.six'
Issue description
I installed pipenv on my Ubuntu 20 system using /usr/bin/pip3 install --user pipenv. When I try installing any package I get the following error:
➜ pipenv install requests
Installing requests...
Installing package: requests
Writing supplied requirement line to temporary file: 'requests'
Installing 'requests'
⠙ Installing requests...$ ['/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/bin/pip', 'install', '--verbose', '--upgrade', '--exists-action=i', '-r', '/tmp/pipenv-bq9czv9c-requirements/pipenv-3e94mp9s-requirement.txt', '-i', 'https://pypi.org/simple']
Using source directory: '/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/src'
Error: An error occurred while installing requests!
Error text:
Traceback (most recent call last):
File "/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/home/ben/.local/share/virtualenvs/blockbuster-yhSJSr9y/lib/python3.8/site-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
ModuleNotFoundError: No module named 'pip._vendor.six'
I can imagine this might be related to interference from pyenv. Simply trying to install the missing six package just tells me it’s already installed. Thanks for any help!
Expected result
Installing packages works.
Actual result
See above.
Steps to replicate
This happens in an empty folder as well, i.e. doesn’t seem related to any pipenv file of mine.
$ pipenv --support
Pipenv version: '2021.5.29'
Pipenv location: '/home/ben/.local/lib/python3.8/site-packages/pipenv'
Python location: '/usr/bin/python3'
Python installations found:
3.9.1:/home/ben/.pyenv/versions/tf/bin/python3.93.9.1:/home/ben/.pyenv/versions/d39/bin/python3.93.9.1:/home/ben/.pyenv/versions/minerl/bin/python3.93.9.1:/home/ben/.pyenv/versions/gen_coco/bin/python3.93.9.1:/home/ben/.pyenv/versions/3.9.1/bin/python3.93.8.10:/usr/bin/python33.8.10:/usr/bin/python3.83.8.10:/bin/python33.8.10:/bin/python3.83.8.7:/home/ben/.pyenv/versions/3.8.7/bin/python33.8.7:/home/ben/.pyenv/versions/d38_pt12/bin/python33.8.7:/home/ben/.pyenv/versions/d38/bin/python33.7.9:/home/ben/.pyenv/versions/d37/bin/python3.73.7.9:/home/ben/.pyenv/versions/3.7.9/bin/python3.7m3.7.9:/home/ben/.pyenv/versions/d37_pd/bin/python3.7
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.8.10',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '5.11.0-34-generic',
'platform_system': 'Linux',
'platform_version': '#36~20.04.1-Ubuntu SMP Fri Aug 27 08:06:32 UTC 2021',
'python_full_version': '3.8.10',
'python_version': '3.8',
'sys_platform': 'linux'}
System environment variables:
LC_TERMINALLC_CTYPELC_TERMINAL_VERSIONUSERLOGNAMEHOMEPATHSHELLTERMSSH_AUTH_SOCKXDG_SESSION_IDXDG_RUNTIME_DIRDBUS_SESSION_BUS_ADDRESSXDG_SESSION_TYPEXDG_SESSION_CLASSMOTD_SHOWNLANGLC_NUMERICLC_TIMELC_MONETARYLC_PAPERLC_NAMELC_ADDRESSLC_TELEPHONELC_MEASUREMENTLC_IDENTIFICATIONSSH_CLIENTSSH_CONNECTIONSSH_TTYSHLVLPWDOLDPWDZSHPAGERLESSLSCOLORSLS_COLORSPYENV_SHELLPYENV_VIRTUALENV_INIT_PIP_DISABLE_PIP_VERSION_CHECKPYTHONDONTWRITEBYTECODEPIP_SHIMS_BASE_MODULEPIP_PYTHON_PATHPYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH:/home/ben/.cargo/bin:/usr/local/bin:/home/ben/.npm-global/bin:/home/ben/.pyenv/plugins/pyenv-virtualenv/shims:/home/ben/.pyenv/shims:/home/ben/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ben/.local/binSHELL:/bin/zshLANG:en_US.UTF-8PWD:/home/ben/devel/adv/test_folder
Contents of Pipfile (‘/media/ben/data/devel/test_folder/Pipfile’):
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "3.9"
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 20 (4 by maintainers)
Ok I figured it out for my issue.
I did not have
pipenvinstalled for the version of python I was using$ pyenv global 3.10.0$ pip install pipenvSolves this issue for me.
Had the same issue as well. New installation of python 3.10.2 on ubuntu 20. Created a virtualenv the way I normally would
virtualenv -p python3.10 envbut then ran into this exact issue trying to install a library via pip. The solution was to delete the newly created virtualenv and then recreate using the venv module in python3.10.2 thusI ran into this problem after installing python 3.9.10 from source, then created a virtualenv using it, but couldn’t install any packages but instead got this ``ModuleNotFoundError: No module named ‘pip._vendor.six’
I solved it by running this command:
curl -sS https://bootstrap.pypa.io/get-pip.py | ~/.local3910/bin/python3note here
~/.local3910/bin/python3is the full installation path for the python i installed. I was installing 3.9 alongside 3.8. Instructions for installing are here I also had to recreate the virtualenv.Hope this helps someone
On Ubuntu 20.04 LTS running
rm -rf ~/.local/share/virtualenvsfixed it on my case which cleans up “dangling virtualenv from previous version” as suggested on Ubuntu bug tracker https://bugs.launchpad.net/ubuntu/+source/pipenv/+bug/1885609. Didpipenvinstallation throughpipxalso earlier that was installed bypyenvmanagedpip(Python 3.9.11) but that didn’t solve it by itself.I had to install it through
pipxto have it work :Works with pyenv and works also with asdf
Apt hasn’t updated pipenv in a long time, please use pypi and pip to install.
It should have something to do with the redistributed version of pip on debian systems. So basically don’t install pipenv into the global, use a tool like
pipxshould workUpdate on my end. I had a system-level install of pipenv, and I found in the pipenv documentation that that should be avoided. After I followed the instructions to just have a user-level install with
pip install --user pipenvand adding it to the path the way the documentation says to do so, it worked.