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.

pipenv create virtual env error

See original GitHub issue

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 upgraded to ubuntu 22.04, python became 3.10 and i can not create virtual env via pipenv now

Expected result

create virtual env, and install independencies

Actual result

error

catroll@dell [21时29分38秒] [/tmp/b] 
-> % pipenv shell
/home/catroll/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
/home/catroll/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release
  warnings.warn(
/home/catroll/.local/lib/python3.10/site-packages/pkg_resources/__init__.py:123: PkgResourcesDeprecationWarning: 2.9.0.Odd.Olm is an invalid version and will not be supported in a future release
  warnings.warn(
Creating a virtualenv for this project...
Pipfile: /tmp/b/Pipfile
Using /usr/bin/python (3.10.4) to create virtualenv...
⠴ Creating virtual environment...created virtual environment CPython3.10.4.final.0-64 in 527ms
  creator CPython3Posix(dest=/home/catroll/.local/share/virtualenvs/b-zqNDogBM, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/catroll/.local/share/virtualenv)
    added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment! 
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/__main__.py", line 4, in <module>
    cli()
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/cli/options.py", line 56, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/cli/command.py", line 423, in shell
    do_shell(
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/core.py", line 2428, in do_shell
    ensure_project(
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/core.py", line 553, in ensure_project
    ensure_virtualenv(
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/core.py", line 486, in ensure_virtualenv
    do_create_virtualenv(
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/core.py", line 1013, in do_create_virtualenv
    project._environment = Environment(
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/environment.py", line 70, in __init__
    self._base_paths = self.get_paths()
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/environment.py", line 394, in get_paths
    c = subprocess_run(command)
  File "/home/catroll/.local/lib/python3.10/site-packages/pipenv/utils/processes.py", line 75, in subprocess_run
    return subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/catroll/.local/share/virtualenvs/b-zqNDogBM/bin/python'

Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

mkdir /tmp/b
cd /tmp/b
pipenv shell

pipenv --support /home/catroll/.local/lib/python3.10/site-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release warnings.warn( /home/catroll/.local/lib/python3.10/site-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 0.1.43ubuntu1 is an invalid version and will not be supported in a future release warnings.warn( /home/catroll/.local/lib/python3.10/site-packages/pkg_resources/init.py:123: PkgResourcesDeprecationWarning: 2.9.0.Odd.Olm is an invalid version and will not be supported in a future release warnings.warn(

$ pipenv --support

Pipenv version: '2022.5.2'

Pipenv location: '/home/catroll/.local/lib/python3.10/site-packages/pipenv'

Python location: '/usr/bin/python3'

Python installations found:

  • 3.10.4: /usr/bin/python
  • 3.10.4: /usr/bin/python3
  • 3.10.4: /bin/python
  • 3.10.4: /bin/python3
  • 3.8.5: /home/catroll/.pyenv/versions/3.8.5/bin/python3.8
  • 3.6.0: /home/catroll/.pyenv/versions/3.6.0/bin/python3.6
  • 2.7.18: /usr/bin/python2
  • 2.7.18: /usr/bin/python2.7
  • 2.7.18: /bin/python2
  • 2.7.18: /bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.4',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.15.0-27-generic',
 'platform_system': 'Linux',
 'platform_version': '#28-Ubuntu SMP Thu Apr 14 04:55:28 UTC 2022',
 'python_full_version': '3.10.4',
 'python_version': '3.10',
 'sys_platform': 'linux'}

System environment variables:

  • SYSTEMD_EXEC_PID
  • SSH_AUTH_SOCK
  • SESSION_MANAGER
  • GNOME_TERMINAL_SCREEN
  • LANG
  • LANGUAGE
  • XDG_CURRENT_DESKTOP
  • LC_IDENTIFICATION
  • DEFAULTS_PATH
  • IM_CONFIG_PHASE
  • PWD
  • LIBVIRT_DEFAULT_URI
  • GPG_AGENT_INFO
  • DESKTOP_SESSION
  • USER
  • XDG_MENU_PREFIX
  • LC_MEASUREMENT
  • QT_IM_MODULE
  • HOME
  • DBUS_SESSION_BUS_ADDRESS
  • SSH_AGENT_LAUNCHER
  • LC_NUMERIC
  • GTK_MODULES
  • _
  • WINDOWPATH
  • XDG_SESSION_DESKTOP
  • XDG_CONFIG_DIRS
  • QT_ACCESSIBILITY
  • XDG_DATA_DIRS
  • GNOME_DESKTOP_SESSION_ID
  • LC_TIME
  • GOPROXY
  • LOGNAME
  • MANDATORY_PATH
  • GNOME_TERMINAL_SERVICE
  • LC_PAPER
  • GNOME_SHELL_SESSION_MODE
  • XMODIFIERS
  • PATH
  • XDG_RUNTIME_DIR
  • XDG_SESSION_TYPE
  • SHELL
  • LC_TELEPHONE
  • LC_MONETARY
  • USERNAME
  • VTE_VERSION
  • COLORTERM
  • XAUTHORITY
  • LC_NAME
  • XDG_SESSION_CLASS
  • TERM
  • GDMSESSION
  • DISPLAY
  • LC_ADDRESS
  • SHLVL
  • OLDPWD
  • ZSH
  • PAGER
  • LESS
  • LSCOLORS
  • LS_COLORS
  • DISABLE_AUTO_UPDATE
  • HISTSIZE
  • HISTFILESIZE
  • HISTTIMEFORMAT
  • SAVEHIST
  • TIME_STYLE
  • GVM_ROOT
  • GVM_VERSION
  • GVM_PATH_BACKUP
  • GOPATH
  • GOBIN
  • GO111MODULE
  • JAVA_HOME
  • SDKMAN_DIR
  • SDKMAN_VERSION
  • SDKMAN_CANDIDATES_API
  • SDKMAN_PLATFORM
  • SDKMAN_CANDIDATES_DIR
  • PYENV_ROOT
  • RUSTUP_DIST_SERVER
  • RUSTUP_UPDATE_ROOT
  • NVM_DIR
  • NVM_CD_FLAGS
  • PIP_SHIMS_BASE_MODULE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PIP_PYTHON_PATH
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/catroll/.pyenv/bin:/home/catroll/.sdkman/candidates/java/current/bin:/home/catroll/.gvm/bin:/home/catroll/.config/composer/vendor/bin:/home/catroll/.cargo/bin:/home/catroll/go/bin:/home/catroll/.local/bin:/home/catroll/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/catroll/.dotnet/tools
  • SHELL: /usr/bin/zsh
  • LANG: zh_CN.UTF-8
  • PWD: /tmp/b

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:14

github_iconTop GitHub Comments

3reactions
davidmartos96commented, May 12, 2022

I’m having the same issue after a fresh installation of Fedora 36 (Python 3.10)

The only difference is the file that says it’s missing: ‘/home/david/.local/share/virtualenvs/b-zqNDogBM/local/bin/python’ (ends with /local/bin/python)

2reactions
nmotecommented, May 16, 2022

I’m experiencing the exact same thing as @davidmartos96 after upgrading to Fedora 36. None of the workarounds here or in #5075 addressed the issue for me. To work around, I went to the directory in ~/.local/share/virtualenvs that the error mentioned and manually created a local directory with a bin -> ../bin symlink.

Obviously this is not a great long term fix but it at least got me up and running again for the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv shell fails to create virtual environment - Stack Overflow
It appears pipenv is crashing because it attempts to create a folder that already exists. Try clearing the virtual env with
Read more >
Pipenv won't create environment - Codecademy Forums
The reason I'm asking is that the error is complaining: Using C:/Python/python.exe (None) to create virtualenv… It says (None) Seems to imply ...
Read more >
Configure a Pipenv environment | PyCharm Documentation
Pipenv is a tool that provides all necessary means to create a virtual environment for ... PyCharm shows an error message: Pipenv executable...
Read more >
Pipenv & Virtual Environments
If you're newcomer and you get an error like this: ... While pip can install Python packages, Pipenv is recommended as it's a...
Read more >
Common Pipenv Errors and How to Solve Them: Why Won't it ...
When you begin a project with Pipenv, the tool automatically creates a virtual environment, a Pipfile, and a Pipfile.lock. The Pipfile is very...
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