Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipenv will not create a virtual environment for Python 3.8, but will for 3.7 #3996

Closed
jamesliudotcc opened this issue Oct 20, 2019 · 11 comments
Labels
Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided. triage

Comments

@jamesliudotcc
Copy link

Be 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'):

@frostming
Copy link
Contributor

It seems like an issue of virtualenv, if you can confirm it by using virtualenv directly

@thianda91
Copy link

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: 'e:\program files\python38\lib\site-packages\pipenv'

Python location: 'e:\program files\python38\python.exe'

Python installations found:

  • 3.8.0: E:\Program Files\Python38\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.0',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '7',
 'platform_system': 'Windows',
 'platform_version': '6.1.7601',
 'python_full_version': '3.8.0',
 'python_version': '3.8',
 'sys_platform': 'win32'}

System environment variables:

  • ACLOCAL_PATH
  • ALLUSERSPROFILE
  • APPDATA
  • CLASSPATH
  • COMMONPROGRAMFILES
  • COMPUTERNAME
  • COMSPEC
  • CONFIG_SITE
  • COMMONPROGRAMFILES(X86)
  • COMMONPROGRAMW6432
  • DISPLAY
  • EXEPATH
  • FP_NO_HOST_CHECK
  • HOME
  • HOMEDRIVE
  • HOMEPATH
  • HOSTNAME
  • INFOPATH
  • JAVA_HOME
  • LANG
  • LOCALAPPDATA
  • LOGONSERVER
  • MANPATH
  • MINGW_CHOST
  • MINGW_PACKAGE_PREFIX
  • MINGW_PREFIX
  • MSYSTEM
  • MSYSTEM_CARCH
  • MSYSTEM_CHOST
  • MSYSTEM_PREFIX
  • NUMBER_OF_PROCESSORS
  • ORIGINAL_PATH
  • ORIGINAL_TEMP
  • ORIGINAL_TMP
  • OS
  • ONEDRIVE
  • PATH
  • PATHEXT
  • PKG_CONFIG_PATH
  • PLINK_PROTOCOL
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMFILES
  • PS1
  • PSMODULEPATH
  • PUBLIC
  • PWD
  • PROGRAMDATA
  • PROGRAMFILES(X86)
  • PROGRAMW6432
  • SESSIONNAME
  • SHELL
  • SHLVL
  • SSH_AGENT_PID
  • SSH_ASKPASS
  • SSH_AUTH_SOCK
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TEMP
  • TERM
  • TMP
  • TMPDIR
  • USERDOMAIN
  • USERNAME
  • USERPROFILE
  • WINDIR
  • _
  • HTTP_PROXY
  • HTTPS_PROXY
  • WINDOWS_TRACING_FLAGS
  • WINDOWS_TRACING_LOGFILE
  • 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: D:\home\bin;D:\Git\mingw64\bin;D:\Git\usr\local\bin;D:\Git\usr\bin;D:\Git\usr\bin;D:\Git\mingw64\bin;D:\Git\usr\bin;D:\home\bin;E:\Program Files\Python38\Scripts;E:\Program Files\Python38;E:\Program Files\Python37\Scripts;E:\Program Files\Python37;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\nodejs;D:\Program Files\Java\jdk1.8.0_73\bin;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\Git\cmd;D:\Program Files\Microsoft VS Code\bin;D:\Program Files\Microsoft VS Code\bin;D:\Git\usr\bin\vendor_perl;D:\Git\usr\bin\core_perl
  • SHELL: D:\Git\usr\bin\bash.exe
  • LANG: C.GBK@cjknarrow
  • PWD: D:/home

@jamesliudotcc
Copy link
Author

@frostming Yes, confirm.

It looks like somebody else has commented on this issue also looking for help, so I will not close the the issue. But I am ok. Thanks for your help!

@aflmp
Copy link

aflmp commented Jan 22, 2020

From Issue-729
using environment variable python_full_version with value 3.8.1 fixed pipenv to create virtualenv using 3.8.1 and not 3.7

@zhanwenchen
Copy link

@aflmp I tried python_full_version=3.8.1 pipenv install and PYTHON_FULL_VERSION=3.8.1 pipenv install. Neither worked.

@jamesliudotcc jamesliudotcc reopened this Apr 10, 2020
@walterdolce
Copy link

Same here. Using both python_full_version + pipenv --rm && pipenv install and pipenv is not installing the version of Python specified.

@divyampandey
Copy link

I am facing the same issue but little bit different.

C:\Users\DP250369\PycharmProjects\towards_flask>pipenv install Flask
Creating a virtualenv for this project…
Pipfile: C:\Users\DP250369\PycharmProjects\towards_flask\Pipfile
Using c:\users\dp250369\appdata\local\programs\python\python38\python.exe (3.8.1) to create virtualenv…
[ ==] Creating virtual environment...OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\Users\DP250369\PycharmProjects\towards_flask\search-ms:displayname=Search%20Results%20in%20OS%20(C%3A)&crumb=location:C%3A%5C\Python 3.7'

Can anyone help.

@divyampandey
Copy link

`C:\Users\DP250369\PycharmProjects\towards_flask>python -m pipenv.help

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: 'C:\\Users\\DP250369\\AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\pipenv'

Python location: 'C:\\Users\\DP250369\\AppData\\Local\\Programs\\Python\\Python38\\python.exe'

Python installations found:

  • 3.8.1: C:\Users\DP250369\AppData\Local\Programs\Python\Python38\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.1',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.17134',
 'python_full_version': '3.8.1',
 'python_version': '3.8',
 'sys_platform': 'win32'}

System environment variables:

  • PYSPARK_DRIVER_PYTHON
  • ALLUSERSPROFILE
  • APPDATA
  • COMMONPROGRAMFILES
  • COMMONPROGRAMFILES(X86)
  • COMMONPROGRAMW6432
  • COMPUTERNAME
  • COMSPEC
  • DATACONNECTORLIBPATH
  • DEFLOGDIR
  • DRIVERDATA
  • FSHARPINSTALLDIR
  • HOMEDRIVE
  • HOMEPATH
  • INFA_TRUSTSTORE
  • JAVA_HOME
  • LOCALAPPDATA
  • LOGONSERVER
  • NUMBER_OF_PROCESSORS
  • ONEDRIVE
  • OS
  • PATH
  • PATHEXT
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMDATA
  • PROGRAMFILES
  • PROGRAMFILES(X86)
  • PROGRAMW6432
  • PROMPT
  • PSMODULEPATH
  • PUBLIC
  • PYSPARK_DRIVER_PYTHON_OPTS
  • PYSPARK_PYTHON
  • PYTHONPATH
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TEMP
  • TEST
  • TMP
  • UATDATA
  • USERDNSDOMAIN
  • USERDOMAIN
  • USERDOMAIN_ROAMINGPROFILE
  • USERNAME
  • USERPROFILE
  • WINDIR
  • 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: C:\Informatica\PowerExchange10.4.0;C:\Informatica\PowerExchange10.4.0\bin32;C:\Informatica\10.4.0\clients\tools\datadirect;C:\Informatica\10.4.0\clients\tools\datadirect;C:\Informatica\10.4.0\clients\tools\odbcdrv;C:\Informatica\10.4.0\clients\tools\jdbcdrv;C:\Informatica\10.4.0\clients\tools\sharedlibs;C:\Informatica\PowerExchange10.2.0;C:\Informatica\PowerExchange10.2.0\bin32;C:\Informatica\10.2.0\clients\tools\datadirect;C:\Informatica\10.2.0\clients\tools\odbcdrv;C:\Informatica\10.2.0\clients\tools\jdbcdrv;C:\Informatica\10.2.0\clients\tools\sharedlibs;C:\sparkproject\spark\bin;C:\Program Files (x86)\Gow\bin;C:\Users\DP250369\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\DP250369\AppData\Local\Programs\Python\Python38\;C:\Users\DP250369\AppData\Local\atom\bin;C:\Users\DP250369\AppData\Local\Programs\Git\cmd

Contents of Pipfile ('C:\Users\DP250369\PycharmProjects\towards_flask\Pipfile'):

`

@notconfusing
Copy link

apt install python3.8 made this work for me, when snap install python3.8 didn't.

@matteius
Copy link
Member

Can this be rechecked with pipenv==2022.8.19?

@matteius matteius added the Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided. label Aug 22, 2022
@matteius matteius closed this as completed Nov 5, 2022
@vasiliy-kotov
Copy link

I was displaying the message: "Failed to create virtual environment" . The reason was in the terminal settings in VS Code. It was necessary to click restart in the terminal window and the virtual environment started working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided. triage
Projects
None yet
Development

No branches or pull requests

10 participants