pyenv-virtualenv
pyenv-virtualenv copied to clipboard
`ImportError: No module named six` when creating python2 virtualenv
Creating a python2 based virtualenv appears to no longer work. Running pyenv virtualenv 2.7.17 myvenv
gives the following error:
Traceback (most recent call last):
File "/home/<User>/.pyenv/versions/2.7.17/bin/virtualenv", line 6, in <module>
from virtualenv.__main__ import run_with_catch
File "/home/<User>/.pyenv/versions/2.7.17/lib/python2.7/site-packages/virtualenv/__init__.py", line 3, in <module>
from .run import cli_run
File "/home/<User>/.pyenv/versions/2.7.17/lib/python2.7/site-packages/virtualenv/run/__init__.py", line 5, in <module>
from ..config.cli.parser import VirtualEnvConfigParser
File "/home/<User>/.pyenv/versions/2.7.17/lib/python2.7/site-packages/virtualenv/config/cli/parser.py", line 5, in <module>
from ..env_var import get_env_var
File "/home/<User>/.pyenv/versions/2.7.17/lib/python2.7/site-packages/virtualenv/config/env_var.py", line 5, in <module>
from virtualenv.util.six import ensure_str, ensure_text
File "/home/<User>/.pyenv/versions/2.7.17/lib/python2.7/site-packages/virtualenv/util/six.py", line 8, in <module>
from six import PY2, PY3, binary_type, text_type
ImportError: No module named six
ensurepip is disabled in Debian/Ubuntu for the system python.
Python modules For the system python are usually handled by dpkg and apt-get.
apt-get install python-<module name>
Install the python-pip package to use pip itself. Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.
Installing pip from https://bootstrap.pypa.io/get-pip.py...
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
Using cached pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
Collecting setuptools
Using cached setuptools-44.0.0-py2.py3-none-any.whl (583 kB)
Collecting wheel
Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pip, setuptools, wheel
Attempting uninstall: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/bin/pip'
Consider using the `--user` option or check the permissions.
error: failed to install pip via get-pip.py