Skip to content
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

pipenv shell not activating env on PowerShell for mac (possibly *nix) #6107

Open
samcarswell opened this issue Mar 8, 2024 · 1 comment
Open
Labels
PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge.

Comments

@samcarswell
Copy link
Contributor

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_OPTOUT
  • PSModulePath
  • PIP_DISABLE_PIP_VERSION_CHECK
  • TERM_PROGRAM_VERSION
  • STARSHIP_SESSION_KEY
  • LANG
  • DOTNET_WATCH_SUPPRESS_LAUNCH_BROWSER
  • SHELL
  • LaunchInstanceID
  • XPC_FLAGS
  • __CFBundleIdentifier
  • STARSHIP_SHELL
  • PYENV_SHELL
  • ITERM_PROFILE
  • HOMEBREW_NO_ANALYTICS
  • PIPENV_SHELL
  • TMPDIR
  • DOTNET_CLI_TELEMETRY_OPTOUT
  • SECURITYSESSIONID
  • COLORFGBG
  • HOME
  • XPC_SERVICE_NAME
  • TERM
  • PATH
  • SSH_AUTH_SOCK
  • __CF_USER_TEXT_ENCODING
  • PIP_PYTHON_PATH
  • TERM_PROGRAM
  • COMMAND_MODE
  • LC_TERMINAL
  • nvm_current_version
  • PYTHONFINDER_IGNORE_UNSUPPORTED
  • USER
  • TERM_SESSION_ID
  • COLORTERM
  • LC_TERMINAL_VERSION
  • PWD
  • PIPENV_ACTIVE
  • ITERM_SESSION_ID
  • LOGNAME
  • VIRTUAL_ENV_DISABLE_PROMPT
  • PYTHONDONTWRITEBYTECODE
  • SHLVL

Pipenv–specific environment variables:

  • PIPENV_SHELL: /usr/local/bin/pwsh
  • PIPENV_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/tools
  • SHELL: /opt/homebrew/bin/fish
  • LANG: en_AU.UTF-8
  • PWD: /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"
@samcarswell
Copy link
Contributor Author

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.

@matteius matteius added the PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge. label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge.
Projects
None yet
Development

No branches or pull requests

2 participants