Skip to content

Running pipenv shell in oh-my-posh doesn't set VIRTUAL_ENV #6226

@MrPaulAR

Description

@MrPaulAR

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:

  • zsh: 5.8.1
  • python: 3.12.5
  • pipenv: 2024.0.1

Expected result

After executing pipenv shell typing echo $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.

$  pipenv shell --verbose
Launching subshell in virtual environment...
 . /home/tmpuser/.local/share/virtualenvs/tmp-g6-Tn6kM/bin/activate
--verbose
$  echo $VIRTUAL_ENV       

$  source venv/bin/activate
$  echo $VIRTUAL_ENV
/home/tempuser/tmp/venv

Steps to replicate

  • Create a blank user account
  • Install asdf-vm and python
    • asdf plugin-add python
    • asdf install python latest
    • asdf global python latest
    • pip install pipenv
  • Install oh-my-posh
  • Below is the contents of my .zshrc file
  • mkdir tmp; cd tmp
  • Create pipenv & venv
    • 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:

{'implementation_name': 'cpython',
 'implementation_version': '3.12.5',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.8.12-1-pve',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT_DYNAMIC PMX 6.8.12-1 (2024-08-05T16:17Z)',
 'python_full_version': '3.12.5',
 'python_version': '3.12',
 'sys_platform': 'linux'}

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

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]

[dev-packages]

[requires]
python_version = "3.12"

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Contributor CandidateThe issue has been identified/triaged and contributions are welcomed/encouraged.ai-triaged

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions