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 failing to create new virtualenv witth Import Error #4518

Closed
deadpyxel opened this issue Nov 4, 2020 · 4 comments
Closed

pipenv failing to create new virtualenv witth Import Error #4518

deadpyxel opened this issue Nov 4, 2020 · 4 comments

Comments

@deadpyxel
Copy link

deadpyxel commented Nov 4, 2020

Issue description

Currently I've been unable to create new environments with either running pipenv install black on a bare directory, or using pipenv --python 3.8or any python version. This seems related to pypa/virtualenv#1551.

Expected result

By running the aforementioned command I should end up with:

  • A Pipfile;
  • A Pipfile.lock;
  • A new virtual environment created.

Actual result

The command pipenv --python 3.8 --verbosegives the following output:

Using python: 3.8
Path to python: /usr/bin/python3.8
Creating a virtualenv for this project...
Pipfile: /home/sidious/dev/datawars2-wrapper/Pipfile
Using /usr/bin/python3.8 (3.8.6) to create virtualenv...
⠴ Creating virtual environment...ImportError: cannot import name 'enquote_executable' from 'distlib.scripts' (/home/sidious/.local/lib/python3.8/site-packages/distlib/scripts.py)

✘ Failed creating virtual environment
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1236, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pipenv/cli/command.py", line 198, in cli
    ensure_project(
  File "/usr/lib/python3.8/site-packages/pipenv/core.py", line 576, in ensure_project
    ensure_virtualenv(
  File "/usr/lib/python3.8/site-packages/pipenv/core.py", line 511, in ensure_virtualenv
    do_create_virtualenv(
  File "/usr/lib/python3.8/site-packages/pipenv/core.py", line 979, in do_create_virtualenv
    raise exceptions.VirtualenvCreationException(
pipenv.exceptions.VirtualenvCreationException: Failed to create virtual environment.

Steps to replicate

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

Basically, running the command to create a new virtualenv pipenv --python 3.8 with latest version of virtualenv installed will give you the error in my tests.


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: '2020.11.4'

Pipenv location: '/usr/lib/python3.8/site-packages/pipenv'

Python location: '/usr/bin/python'

Python installations found:

  • 3.8.6: /usr/bin/python3
  • 3.8.6: /usr/bin/python3.8
  • 3.7.6: /home/sidious/.pyenv/versions/3.7.6/bin/python3.7m
  • 2.7.18: /usr/bin/python2
  • 2.7.18: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.6',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.9.3-arch1-1',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT Sun, 01 Nov 2020 12:58:59 +0000',
 'python_full_version': '3.8.6',
 'python_version': '3.8',
 'sys_platform': 'linux'}

System environment variables:

  • ALACRITTY_LOG
  • COLORTERM
  • DBUS_SESSION_BUS_ADDRESS
  • DISPLAY
  • EDITOR
  • GEM_HOME
  • GOPATH
  • GRADLE_HOME
  • GTK_MODULES
  • HOME
  • I3SOCK
  • INVOCATION_ID
  • JAVA_HOME
  • JOURNAL_STREAM
  • LANG
  • LC_COLLATE
  • LESS
  • LOGNAME
  • LSCOLORS
  • LS_COLORS
  • MAIL
  • MOTD_SHOWN
  • MOZ_PLUGIN_PATH
  • NVM_BIN
  • NVM_CD_FLAGS
  • NVM_DIR
  • NVM_INC
  • OLDPWD
  • PAGER
  • PATH
  • PWD
  • PYENV_SHELL
  • PYENV_VIRTUALENV_INIT
  • SHELL
  • SHLVL
  • SMLNJ_HOME
  • TERM
  • TMUX
  • TMUX_PANE
  • USER
  • WINDOWID
  • WINDOWPATH
  • XAUTHORITY
  • XDG_RUNTIME_DIR
  • XDG_SEAT
  • XDG_SESSION_CLASS
  • XDG_SESSION_ID
  • XDG_SESSION_TYPE
  • XDG_VTNR
  • ZSH
  • _
  • LC_CTYPE
  • PS1
  • 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/sidious/go/bin:/home/sidious/.pyenv/plugins/pyenv-virtualenv/shims:/home/sidious/.pyenv/shims:/home/sidious/.pyenv/bin:/home/sidious/.gems/bin:/home/sidious/go/bin:/home/sidious/.pyenv/plugins/pyenv-virtualenv/shims:/home/sidious/.pyenv/shims:/home/sidious/.pyenv/bin:/home/sidious/.gems/bin:/home/sidious/.nvm/versions/node/v12.19.0/bin:/home/sidious/go/bin:/home/sidious/.pyenv/plugins/pyenv-virtualenv/shims:/home/sidious/.pyenv/shims:/home/sidious/.pyenv/bin:/home/sidious/.gems/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/smlnj/bin:/usr/lib/jvm/default/bin:/usr/lib/smlnj/bin
  • SHELL: /usr/bin/zsh
  • EDITOR: vim
  • LANG: en_GB.utf8
  • PWD: /home/sidious/dev/sample-project

As an additional note, I've been having the same issue if I use virtualenv directly, but running python -m venv venv has no issues creating the environment, so while I think this is an issue that will need some work around, I think this deserves reporting if this tool has dependencies with virtualenv.

@frostming
Copy link
Contributor

There is likely something wrong with your installation of virtualenv. Please try to uninstall virtualenv and install the latest virtualenv.

@deadpyxel
Copy link
Author

That was my first try, but thing is, pipenv was working fine until a recent update in Archlinux python-virtualenv package, 2 days ago (November 3rd), that's why I think it's not a pipenv issue, but maybe a regression of sorts.

@frostming
Copy link
Contributor

I suggest reporting this to the virtualenv project with the command output of virtualenv

@deadpyxel
Copy link
Author

Did a report, but it seems that I'll have to go for the python-virtualenv Archlinux package maintener. Thansk for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants