pipenv shell does not work when running Git for Windows' bash on Windows
See original GitHub issueIssue description
Running pipenv shell
on windows when running bash in Git for Windows does not activate the virtual env successfully. It appears the actual activate script with the correct values is not being used.
Expected result
I would successfully be in the virtualenv
Actual result
The VIRTUAL_ENV
and PATH
variables are in the C:
notation instead of /c/
notation which would have worked.
declare -x VIRTUAL_ENV="C:\\Users\\user\\.virtualenvs\\project-OJ2s3Ey8"
declare -x PATH="C:/Users/user/.virtualenvs/project-OJ2s3Ey8/Scripts:/c/Users/user/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/usr/bin:/mingw64/bin:/usr/bin:/c/Users/andy/bin:/c/Python37/Scripts:/c/Python37" etc...
Sourcing the virtualenv activate variable does work, even though Git for Windows uses msys
and not cygwin
. Did not test cygwin
Steps to replicate
pipenv install sphinx
echo $$
pipenv shell
echo $$
pip freeze
echo $PATH
Shows that the pip environment is the original python environment, not the virtualenv. The different pid verifies that a new shell is indeed being run, but the virtualenv is not activating
Also tried
PIPENV_EMULATOR=bash pipenv shell
Identical results
$ pipenv --support
Pipenv version: '2018.7.1'
Pipenv location: 'c:\\python37\\lib\\site-packages\\pipenv'
Python location: 'c:\\python37\\python.exe'
Other Python installations in PATH
:
-
3.7
:C:\Python37\python.exe
-
3.7.0
:C:\Python37\python.exe
-
3.7.0
:C:\Windows\py.exe
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.0',
'os_name': 'nt',
'platform_machine': 'AMD64',
'platform_python_implementation': 'CPython',
'platform_release': '10',
'platform_system': 'Windows',
'platform_version': '10.0.17134',
'python_full_version': '3.7.0',
'python_version': '3.7',
'sys_platform': 'win32'}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
@uranusjr I agree then, let cygwin be.
For the record, I was always using cpython.
Honestly, I think option 3 is the best (or another variable name if that’s the correct way to go). It would cover anyone else’s corner case, without requiring pipenv to be knowledgeable about the different systems.
I kind of agree that using the msys/cygwin can lead to issues. But long story short, I have a bunch of scripts that I maintain and writing them in ps/batch too was just too much (tried it). And running in WSL won’t work for the software I use 😦
You do know what you’re doing, however, so if it works, let it be! It’s lucky for us you file this first before some random folk come yelling because things don’t work 😉
I did implement a
msys
key you can setPIPENV_EMULATOR
to if you want to force the behaviour, but if I did everythign right, the environment should be detected with the patch, yielding the correctPATH
format. Please do try it out if you could to make sure it works!