Closed rg-gravis closed 1 month ago
I believe this is fixed by https://github.com/pypa/pipenv/pull/6246 ?
Is this blocking CIs? -- if so we can cut a bugfix release.
Just cut 2024.0.3
Can confirm it's fixed for me!
This is still broken for me. Both my stack trace and the one in the issue body are for line 83, not the line fixed in the linked PR. It seems that in handling another error it's blowing up on the color handling. So, if you reverted and then got another error and fixed that you would not see this one again when you pull in the new version.
https://github.com/yosufali/pipenv/blob/main/pipenv/utils/virtualenv.py#L83
@crimsonknave can you confirm which version you have installed?
Yes, it's 2024.0.3
according to pipenv --version
.
I'm having trouble reproducing this locally, but, it's been consistent in my actions CI runs (in a docker container) and I ran pipenv --version
right before running pipenv run python path/to/file.py
.
+ pipenv --version
pipenv, version 2024.0.3
+ pipenv run python path/to/file.py
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Creating a virtualenv for this project
Pipfile: /github/workspace/Pipfile
Using /usr/bin/python33.12.6 to create virtualenv...
SystemExit: 2
Failed creating virtual environment
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 8, in <module>
sys.exit(cli())
^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/vendor/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/cli/options.py", line 52, in main
return super().main(*args, **kwargs, windows_expand_args=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/vendor/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/vendor/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/vendor/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/vendor/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/vendor/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/vendor/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/cli/command.py", line 422, in run
do_run(
File "/usr/local/lib/python3.12/dist-packages/pipenv/routines/shell.py", line 68, in do_run
ensure_project(
File "/usr/local/lib/python3.12/dist-packages/pipenv/utils/project.py", line 48, in ensure_project
ensure_virtualenv(
File "/usr/local/lib/python3.12/dist-packages/pipenv/utils/virtualenv.py", line 147, in ensure_virtualenv
do_create_virtualenv(
File "/usr/local/lib/python3.12/dist-packages/pipenv/utils/virtualenv.py", line 83, in do_create_virtualenv
raise exceptions.VirtualenvCreationException(extra=f"[red]{error}[/red]")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/exceptions.py", line 252, in __init__
extra = unstyle(f"{extra}")
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/pipenv/exceptions.py", line 16, in unstyle
stripped_text = styled_text.strip_styles()
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Text' object has no attribute 'strip_styles'
I am able to reproduce this locally now.
sudo mkdir /tmp/demo
cd /tmp/demo
export PIPENV_VENV_IN_PROJECT=1
pipenv --version
pipenv run python
pipenv, version 2024.0.3
Creating a virtualenv for this project
Pipfile: /tmp/demo/Pipfile
Using default python from /usr/bin/python33.10.12 to create virtualenv...
⠋ Creating virtual environment...SystemExit: 2
✘ Failed creating virtual environment
Traceback (most recent call last):
File "/home/crimsonknave/.local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/cli/options.py", line 52, in main
return super().main(*args, **kwargs, windows_expand_args=False)
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/vendor/click/decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/vendor/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/cli/command.py", line 422, in run
do_run(
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/routines/shell.py", line 68, in do_run
ensure_project(
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/utils/project.py", line 48, in ensure_project
ensure_virtualenv(
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/utils/virtualenv.py", line 147, in ensure_virtualenv
do_create_virtualenv(
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/utils/virtualenv.py", line 83, in do_create_virtualenv
raise exceptions.VirtualenvCreationException(extra=f"[red]{error}[/red]")
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/exceptions.py", line 252, in __init__
extra = unstyle(f"{extra}")
File "/home/crimsonknave/.local/lib/python3.10/site-packages/pipenv/exceptions.py", line 16, in unstyle
stripped_text = styled_text.strip_styles()
AttributeError: 'Text' object has no attribute 'strip_styles'
Using 2024.0.1
I get the real error (this is from my actions run):
+ pipenv --version
pipenv, version 2024.0.1
+ pipenv -v run python path/to/script.py
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Using python: 3.12
Path to python: /usr/bin/python3
Creating a virtualenv for this project...
Pipfile: /github/workspace/Pipfile
Using /usr/bin/python3 (3.12.6) to create virtualenv...
SystemExit: 2
Failed creating virtual environment
[pipenv.exceptions.VirtualenvCreationException]: usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
[--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
[--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip] [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
dest
virtualenv: error: argument dest: the destination . is not write-able at /github/workspace
Failed to create virtual environment.
Can you share which docker image are you using as base? is this debian\ubuntu\alpine or the plain python3 docker base image?
I can't reproduce this error.
mkdir foo
oznt@dell-gentoo:/tmp |.venv| $cd foo/
oznt@dell-gentoo:/tmp/foo |.venv| $pipenv install requests
Courtesy Notice:
Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set
PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead.
You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Creating a Pipfile for this project...
Installing requests...
Resolving requests...
Added requests to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock not found, creating...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (1977acb1ba9778abb66054090e2618a0a1f1759b1b3b32afd8a7d404ba18b4fb)!
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing dependencies from Pipfile.lock (18b4fb)..
This error happens for me on Mac from cli using 2024.0.3 Simple Pipfile with just a python version in it (3.12.0)
@peter-daptl thanks for sharing. Please tell me how you installed Python on MacOS. Is it homebrew ?
@oz123 I use pyenv which was installed with brew
Tried using both pipenv install
and pipenv install --python ~/.pyenv/versions/3.12.0/bin/python
I don't really understand the cause, but I opened a PR that catches the attribute error, that I believe should help with this. I hope to cut a release on Sunday (tomorrow).
Issue description
pipenv install requests
throws the following error when run in a new, empty directory:Expected result
Virtual environment is created with
requests
installedActual result
Steps to replicate
$ pipenv --support
Pipenv version: `'2024.0.2'` Pipenv location: `'/home/rye/.local/lib/python3.8/site-packages/pipenv'` Python location: `'/usr/bin/python3'` OS Name: `'posix'` User pip version: `'24.0'` user Python installations found: PEP 508 Information: ``` {'implementation_name': 'cpython', 'implementation_version': '3.8.10', 'os_name': 'posix', 'platform_machine': 'x86_64', 'platform_python_implementation': 'CPython', 'platform_release': '5.15.0-119-generic', 'platform_system': 'Linux', 'platform_version': '#129~20.04.1-Ubuntu SMP Wed Aug 7 13:07:13 UTC 2024', 'python_full_version': '3.8.10', 'python_version': '3.8', 'sys_platform': 'linux'} ``` System environment variables: - `SSH_AUTH_SOCK` - `TERM` - `PAPERSIZE` - `SSH_AGENT_PID` - `XDG_CURRENT_DESKTOP` - `LANG` - `LC_IDENTIFICATION` - `ROS_PACKAGE_PATH` - `PWD` - `GPG_AGENT_INFO` - `USER` - `DESKTOP_SESSION` - `HOME` - `COLORTERM` - `LC_MEASUREMENT` - `TERMINATOR_UUID` - `VTE_VERSION` - `DBUS_SESSION_BUS_ADDRESS` - `XDG_VTNR` - `XDG_SEAT` - `LC_NUMERIC` - `I3SOCK` - `GTK_MODULES` - `XDG_CONFIG_DIRS` - `WINDOWPATH` - `XDG_SESSION_DESKTOP` - `QT_ACCESSIBILITY` - `XDG_DATA_DIRS` - `LC_TIME` - `LOGNAME` - `LC_PAPER` - `PATH` - `XDG_RUNTIME_DIR` - `SHELL` - `XDG_SESSION_ID` - `LC_MONETARY` - `LC_TELEPHONE` - `USERNAME` - `XDG_SESSION_TYPE` - `TERMINATOR_DBUS_NAME` - `SHLVL` - `XAUTHORITY` - `LC_NAME` - `XDG_SESSION_CLASS` - `DISPLAY` - `LC_ADDRESS` - `TERMINATOR_DBUS_PATH` - `GDMSESSION` - `OLDPWD` - `ZSH` - `PAGER` - `LESS` - `LSCOLORS` - `LS_COLORS` - `P9K_SSH` - `_P9K_SSH_TTY` - `P9K_TTY` - `_P9K_TTY` - `_` - `PIP_DISABLE_PIP_VERSION_CHECK` - `PYTHONDONTWRITEBYTECODE` - `PYTHONFINDER_IGNORE_UNSUPPORTED` Pipenv–specific environment variables: Debug–specific environment variables: - `PATH`: `/home/rye/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/rye/.fzf/bin` - `SHELL`: `/usr/bin/zsh` - `LANG`: `en_US.UTF-8` - `PWD`: `/home/rye/Documents/pipenv-test` ---------------------------