question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleNotFoundError: No module named 'pip._vendor.six'

See original GitHub issue

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.9
  • 3.9.1: /home/ben/.pyenv/versions/d39/bin/python3.9
  • 3.9.1: /home/ben/.pyenv/versions/minerl/bin/python3.9
  • 3.9.1: /home/ben/.pyenv/versions/gen_coco/bin/python3.9
  • 3.9.1: /home/ben/.pyenv/versions/3.9.1/bin/python3.9
  • 3.8.10: /usr/bin/python3
  • 3.8.10: /usr/bin/python3.8
  • 3.8.10: /bin/python3
  • 3.8.10: /bin/python3.8
  • 3.8.7: /home/ben/.pyenv/versions/3.8.7/bin/python3
  • 3.8.7: /home/ben/.pyenv/versions/d38_pt12/bin/python3
  • 3.8.7: /home/ben/.pyenv/versions/d38/bin/python3
  • 3.7.9: /home/ben/.pyenv/versions/d37/bin/python3.7
  • 3.7.9: /home/ben/.pyenv/versions/3.7.9/bin/python3.7m
  • 3.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_TERMINAL
  • LC_CTYPE
  • LC_TERMINAL_VERSION
  • USER
  • LOGNAME
  • HOME
  • PATH
  • SHELL
  • TERM
  • SSH_AUTH_SOCK
  • XDG_SESSION_ID
  • XDG_RUNTIME_DIR
  • DBUS_SESSION_BUS_ADDRESS
  • XDG_SESSION_TYPE
  • XDG_SESSION_CLASS
  • MOTD_SHOWN
  • LANG
  • LC_NUMERIC
  • LC_TIME
  • LC_MONETARY
  • LC_PAPER
  • LC_NAME
  • LC_ADDRESS
  • LC_TELEPHONE
  • LC_MEASUREMENT
  • LC_IDENTIFICATION
  • SSH_CLIENT
  • SSH_CONNECTION
  • SSH_TTY
  • SHLVL
  • PWD
  • OLDPWD
  • ZSH
  • PAGER
  • LESS
  • LSCOLORS
  • LS_COLORS
  • PYENV_SHELL
  • PYENV_VIRTUALENV_INIT
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_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/bin
  • SHELL: /bin/zsh
  • LANG: en_US.UTF-8
  • PWD: /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"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
tyronepostcommented, Oct 15, 2021

Ok I figured it out for my issue.

I did not have pipenv installed for the version of python I was using

$ pyenv global 3.10.0 $ pip install pipenv

Solves this issue for me.

8reactions
ngenovictorcommented, Feb 10, 2022

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 env but 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 thus

rm -r env
python3.10.2 -m venv env
Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleNotFoundError: No module named 'pip._vendor.six'
I was getting ModuleNotFoundError: No module named 'pip._vendor.six' errors when running Django app on Ubuntu 20.04 LTS with pipenv.
Read more >
Decoding the 'No module named pip._vendor.six' error message
The reason for this message as follows: ... The error message above is seen if pip is DEBUNDLED (i.e., 3 is true) and...
Read more >
pip3 install not working - No module named 'pip._vendor ...
Un-installing and re-installing pip3 using the following code: sudo apt-get remove python3-pip followed by sudo apt-get install python3-pip .
Read more >
[Fixed] ModuleNotFoundError: No module named 'pip' - Finxter
How to Fix “ModuleNotFoundError: No module named 'pip'” in PyCharm · Open File > Settings > Project from the PyCharm menu. · Select...
Read more >
No module named pip._vendor.pkg_resources | bobbyhadz
The "ModuleNotFoundError: No module named 'pip._vendor.pkg_resources'" is caused when pip is not installed or is outdated, most commonly on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found