-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
AttributeError: 'Text' object has no attribute 'strip_styles' when creating virtual environment #6248
Comments
I believe this is fixed by #6246 ? Is this blocking CIs? -- if so we can cut a bugfix release. |
Just cut |
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 |
I'm having trouble reproducing this locally, but, it's been consistent in my actions CI runs (in a docker container) and I ran
|
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 + 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.
|
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 |
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
pip install --user pipenv mkdir pipenv-test cd pipenv-test pipenv install requests
$ 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:
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
The text was updated successfully, but these errors were encountered: