question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pipenv shell does not work when running Git for Windows' bash on Windows

See original GitHub issue
Issue 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
  1. pipenv install sphinx
  2. echo $$
  3. pipenv shell
  4. echo $$
  5. pip freeze
  6. 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

  1. 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:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
andyneffcommented, Jul 24, 2018

@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 😦

0reactions
uranusjrcommented, Jul 24, 2018

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 set PIPENV_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 correct PATH format. Please do try it out if you could to make sure it works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv install/pipenv shell not working with Git Bash on ...
Every tutorial I've watched on setting up my environment and installing pipenv has just used pipenv install/shell. python · windows · bash ......
Read more >
pipenv install/pipenv shell not working with Git Bash on ...
I resolve this by uninstalling the latest version 2022.1.8 of pipenv and install the version of 2021.5.29 , which is a working version...
Read more >
Pipenv shell doesn't work - Command Line
Hello, I have the following problem, pipenv shell command does not open the line that allowing to enter the language you want to...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
Run the following command: pipenv lock --clear. and try again. If this does not work, try manually deleting the whole cache directory. It...
Read more >
pipenv Documentation - Read the Docs
It's because this command is intended to be run in a shell (also called a ... Once again, you should not run pipenv...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found