Pipenv will not create a virtual environment for Python 3.8, but will for 3.7
See original GitHub issueBe sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.
Check the diagnose documentation for common issues before posting! We may close your issue if it is very similar to one of them. Please be considerate, or be on your way.
Make sure to mention your debugging experience if the documented solution failed.
Issue description
When I try to create a pipenv virtual environment with Python 3.8, it fails, with the error message, ModuleNotFoundError: No module name 'distutils.spawn'
Here is the full context:
➜ pipenv --python 3.8
Creating a virtualenv for this project…
Pipfile: /home/james/learning/cs-python/Pipfile
Using /usr/bin/python3.8 (3.8.0) to create virtualenv…
⠙ Creating virtual environment...Running virtualenv with interpreter /usr/bin/python3.8
✘ Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: File "/home/james/.local/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
[pipenv.exceptions.VirtualenvCreationException]: return f(get_current_context(), *args, **kwargs)
[pipenv.exceptions.VirtualenvCreationException]: File "/home/james/.local/lib/python3.6/site-packages/pipenv/cli/command.py", line 208, in cli
[pipenv.exceptions.VirtualenvCreationException]: clear=state.clear,
[pipenv.exceptions.VirtualenvCreationException]: File "/home/james/.local/lib/python3.6/site-packages/pipenv/core.py", line 574, in ensure_project
[pipenv.exceptions.VirtualenvCreationException]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.VirtualenvCreationException]: File "/home/james/.local/lib/python3.6/site-packages/pipenv/core.py", line 506, in ensure_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: python=python, site_packages=site_packages, pypi_mirror=pypi_mirror
[pipenv.exceptions.VirtualenvCreationException]: File "/home/james/.local/lib/python3.6/site-packages/pipenv/core.py", line 935, in do_create_virtualenv
[pipenv.exceptions.VirtualenvCreationException]: extra=[crayons.blue("{0}".format(c.err)),]
[pipenv.exceptions.VirtualenvCreationException]: Traceback (most recent call last):
File "/home/james/.local/lib/python3.6/site-packages/virtualenv.py", line 24, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
Failed to create virtual environment.
When I run `pipenv --python 3.8`, it works!
Expected result
The virtual environment should be created correctly.
When possible, provide the verbose output (--verbose
), especially for locking and dependencies resolving issues.
Steps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
Please run $ pipenv --support
, and paste the results here. Don’t put backticks (`
) around it! The output already contains Markdown formatting.
$ pipenv --support
Pipenv version: '2018.11.26'
Pipenv location: '/home/james/.local/lib/python3.6/site-packages/pipenv'
Python location: '/usr/bin/python3'
Python installations found:
3.8.0
:/usr/bin/python3.8
3.7.5
:/usr/bin/python3.7
3.7.5
:/usr/bin/python3.7m
3.6.8
:/usr/bin/python3
3.6.8
:/usr/bin/python3.6m
2.7.15
:/usr/bin/python
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.8',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '5.0.0-29-generic',
'platform_system': 'Linux',
'platform_version': '#31~18.04.1-Ubuntu SMP Thu Sep 12 18:29:21 UTC 2019',
'python_full_version': '3.6.8',
'python_version': '3.6',
'sys_platform': 'linux'}
System environment variables:
XDG_SEAT
XDG_SESSION_ID
WINDOWPATH
LC_IDENTIFICATION
DISPLAY
GJS_DEBUG_TOPICS
COLORTERM
GNOME_TERMINAL_SERVICE
GNOME_DESKTOP_SESSION_ID
DEFAULTS_PATH
LOGNAME
TEXTDOMAIN
LC_TIME
SHELL
PAPERSIZE
PATH
LC_NUMERIC
LC_PAPER
IM_CONFIG_PHASE
TEXTDOMAINDIR
CLUTTER_IM_MODULE
QT4_IM_MODULE
XMODIFIERS
XDG_MENU_PREFIX
GNOME_SHELL_SESSION_MODE
XAUTHORITY
XDG_SESSION_DESKTOP
GDMSESSION
QT_IM_MODULE
SSH_AUTH_SOCK
LC_ADDRESS
LC_MEASUREMENT
XDG_CONFIG_DIRS
MANDATORY_PATH
USERNAME
DESKTOP_SESSION
XDG_RUNTIME_DIR
GTK_IM_MODULE
USER
GTK_MODULES
PWD
VTE_VERSION
LC_MONETARY
HOME
QT_ACCESSIBILITY
SSH_AGENT_PID
XDG_DATA_DIRS
LANGUAGE
LANG
LC_NAME
GNOME_TERMINAL_SCREEN
GPG_AGENT_INFO
SHLVL
GJS_DEBUG_OUTPUT
XDG_VTNR
XDG_SESSION_TYPE
DBUS_SESSION_BUS_ADDRESS
XDG_CURRENT_DESKTOP
TERM
SESSION_MANAGER
LC_TELEPHONE
OLDPWD
LS_COLORS
SPACESHIP_VERSION
SPACESHIP_ROOT
NVM_DIR
NVM_CD_FLAGS
NVM_BIN
EDITOR
_
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/james/.local/bin:/home/james/.nvm/versions/node/v12.9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/cuda/bin:/snap/bin
SHELL
:/usr/bin/zsh
EDITOR
:emacs -nw
LANG
:en_US.UTF-8
PWD
:/home/james/learning/cs-python
Contents of Pipfile
(‘/home/james/learning/cs-python/Pipfile’):
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:10 (1 by maintainers)
Top GitHub Comments
apt install python3.8
made this work for me, whensnap install python3.8
didn’t.Can this be rechecked with
pipenv==2022.8.19
?