pipenv
pipenv copied to clipboard
`pipenv shell` not activating env on PowerShell for mac (possibly *nix)
Issue description
Using pipenv shell on Powershell for mac does not activate the environment. Instead it displays the source command for bash and does not attempt to execute it. I can add .ps1 and hit enter to activate the environment correctly.
Expected result
pipenv shell to automatically activate the environment, like it does with fish or bash.
Actual result
psh ❯ pipenv shell
Creating a virtualenv for this project...
Pipfile: /Users/scar/tmp/test-pipenv/Pipfile
Using default python from /Users/scar/.pyenv/versions/3.11.8/bin/python3.11 (3.11.8) to create virtualenv...
⠙ Creating virtual environment...created virtual environment CPython3.11.8.final.0-64 in 162ms
creator CPython3Posix(dest=/Users/scar/.local/share/virtualenvs/test-pipenv-W2MgHCvQ, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/scar/Library/Application Support/virtualenv)
added seed packages: pip==24.0, setuptools==69.0.3, wheel==0.42.0
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
✔ Successfully created virtual environment!
Virtualenv location: /Users/scar/.local/share/virtualenvs/test-pipenv-W2MgHCvQ
Creating a Pipfile for this project...
Launching subshell in virtual environment...
. /Users/scar/.local/share/virtualenvs/test-pipenv-W2MgHCvQ/bin/activate
PowerShell 7.4.1
~/tmp/test-pipenv 🐍 v3.11.8
psh ❯ . /Users/scar/.local/share/virtualenvs/test-pipenv-W2MgHCvQ/bin/activate
The shell is left here, with the bash source command not executed.
Steps to replicate
Displayed above in actual result
$ pipenv --support
Pipenv version: '2023.12.1'
Pipenv location: '/Users/scar/.local/lib/python3.11/site-packages/pipenv'
Python location: '/Users/scar/.pyenv/versions/3.11.8/bin/python3.11'
OS Name: 'posix'
User pip version: '23.3.2'
user Python installations found:
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.11.8',
'os_name': 'posix',
'platform_machine': 'arm64',
'platform_python_implementation': 'CPython',
'platform_release': '23.3.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:59 PST '
'2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6030',
'python_full_version': '3.11.8',
'python_version': '3.11',
'sys_platform': 'darwin'}
System environment variables:
POWERSHELL_TELEMETRY_OPTOUTPSModulePathPIP_DISABLE_PIP_VERSION_CHECKTERM_PROGRAM_VERSIONSTARSHIP_SESSION_KEYLANGDOTNET_WATCH_SUPPRESS_LAUNCH_BROWSERSHELLLaunchInstanceIDXPC_FLAGS__CFBundleIdentifierSTARSHIP_SHELLPYENV_SHELLITERM_PROFILEHOMEBREW_NO_ANALYTICSPIPENV_SHELLTMPDIRDOTNET_CLI_TELEMETRY_OPTOUTSECURITYSESSIONIDCOLORFGBGHOMEXPC_SERVICE_NAMETERMPATHSSH_AUTH_SOCK__CF_USER_TEXT_ENCODINGPIP_PYTHON_PATHTERM_PROGRAMCOMMAND_MODELC_TERMINALnvm_current_versionPYTHONFINDER_IGNORE_UNSUPPORTEDUSERTERM_SESSION_IDCOLORTERMLC_TERMINAL_VERSIONPWDPIPENV_ACTIVEITERM_SESSION_IDLOGNAMEVIRTUAL_ENV_DISABLE_PROMPTPYTHONDONTWRITEBYTECODESHLVL
Pipenv–specific environment variables:
PIPENV_SHELL:/usr/local/bin/pwshPIPENV_ACTIVE:1
Debug–specific environment variables:
PATH:/Users/scar/.pyenv/versions/3.11.8/bin:/Users/scar/.pyenv/versions/3.9.18/bin:/usr/local/microsoft/powershell/7:/Users/scar/.pyenv/versions/3.11.8/bin:/Users/scar/.pyenv/versions/3.9.18/bin:/Users/scar/.pyenv/versions/3.11.8/bin:/Users/scar/.pyenv/versions/3.9.18/bin:/Users/scar/.pyenv/versions/3.11.8/bin:/Users/scar/.pyenv/versions/3.9.18/bin:/usr/local/microsoft/powershell/7:/Users/scar/.pyenv/shims:/Users/scar/.local/share/nvm/v17.9.1/bin:/Users/scar/.local/bin:/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/share/dotnet:~/.dotnet/toolsSHELL:/opt/homebrew/bin/fishLANG:en_AU.UTF-8PWD:/Users/scar/tmp/test-pipenv
Contents of Pipfile ('/Users/scar/tmp/test-pipenv/Pipfile'):
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
[dev-packages]
[requires]
python_version = "3.11"
The solution was for me to use --fancy. By setting $env:PIPENV_SHELL_FANCY = 1 in my profile.ps1 I'm able to use the command in the same way as other shells and omit the flag.