-
-
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
Running pipenv shell in oh-my-posh doesn't set VIRTUAL_ENV #6226
Comments
Facing exactly the same issue here. |
There is a discussion in JanDeDobbeleer/oh-my-posh#5573 where @CVirus identified that if you create a shell with |
Is this something that can be worked into: #6230 |
I don't think that a fix for the issue should be incorporated into the PR you mentioned, as it is a local fix for a thing which already worked. I believe the |
Analysis of Pipenv Issue #62261. Problem Summary: The issue reports that 2. Comment Analysis:
3. Proposed Resolution: The problem likely stems from Oh My Posh overriding the Given that a working solution exists with
4. Code Snippet (pipenv/cli/command.py): @pass_state
def shell(state, fancy=False, shell_args=None, anyway=False, quiet=False):
# ... (Existing Code) ...
# Detect Oh My Posh in Zsh
if os.environ.get("POSH_THEME") and shell.cmd.endswith("zsh"):
click.echo(
"Warning: Oh My Posh detected. 'pipenv shell' may not activate the "
"virtual environment correctly. Consider using `pipenv shell --fancy`.",
err=True,
)
# ... (Rest of the code) ... 5. Additional Steps:
This issue highlights the complexity of managing environment variables across different shells and customization tools. By documenting the known issue and exploring collaborative solutions, we can provide a more reliable experience for Pipenv users. |
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
On a zsh shell on Arch, Ubuntu, & WSL when I execute
pipenv shell
the env variable VIRTUAL_ENV is not being set. If I create a traditional venv and activate it then the variable is being set.Versions:
Expected result
After executing
pipenv shell
typingecho $VIRTUAL_ENV
should show the name of the virtual environment.Actual result
When possible, provide the verbose output (
--verbose
), especially for locking and dependencies resolving issues.Steps to replicate
asdf-vm
and pythonasdf plugin-add python
asdf install python latest
asdf global python latest
pip install pipenv
oh-my-posh
mkdir tmp; cd tmp
pipenv install
python -m venv venv
Inside this temp dir I can activate either of the virutal enviroments but only the venv one sets the VIRTUAL_ENV env variable.
$ pipenv --support
Pipenv version:
'2024.0.1'
Pipenv location:
'/home/tmpuser/.asdf/installs/python/3.12.5/lib/python3.12/site-packages/pipenv'
Python location:
'/home/tmpuser/.asdf/installs/python/3.12.5/bin/python3.12'
OS Name:
'posix'
User pip version:
'24.0'
user Python installations found:
PEP 508 Information:
System environment variables:
PATH
SHELL
ZLE_RPROMPT_INDENT
POSH_PID
SSH_AUTH_SOCK
PWD
LOGNAME
XDG_SESSION_TYPE
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME
MOTD_SHOWN
HOME
LANG
POSH_SHELL_VERSION
OSTYPE
CONDA_PROMPT_MODIFIER
ASDF_DATA_DIR
SSH_CONNECTION
XDG_SESSION_CLASS
TERM
POSH_PROMPT_COUNT
ASDF_DIR
USER
SHLVL
XDG_SESSION_ID
POSH_THEME
XDG_RUNTIME_DIR
SSH_CLIENT
DEBUGINFOD_URLS
ASDF_CONFIG_FILE
DBUS_SESSION_BUS_ADDRESS
MAIL
SSH_TTY
POWERLINE_COMMAND
OLDPWD
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_PYTHON_PATH
PIPENV_ACTIVE
_
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_ACTIVE
:1
Debug–specific environment variables:
PATH
:/home/tmpuser/.asdf/installs/python/3.12.5/bin:/home/tmpuser/.asdf/plugins/python/shims:/home/tmpuser/.asdf/installs/python/3.12.5/bin:/home/tmpuser/.asdf/shims:/home/tmpuser/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/tmpuser/.local/bin:/home/tmpuser/.local/bin
SHELL
:/usr/bin/zsh
LANG
:C.UTF-8
PWD
:/home/tmpuser/temprepo
Contents of
Pipfile
('/home/tmpuser/temprepo/Pipfile'):I'm not sure if this is oh-my-posh squashing the env var or pipenv not setting it, if nothing else hoping for some direction.
The text was updated successfully, but these errors were encountered: