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 malforms PATH on git bash for windows #970

Closed
EGrunzke opened this issue Oct 24, 2017 · 7 comments
Closed

pipenv shell malforms PATH on git bash for windows #970

EGrunzke opened this issue Oct 24, 2017 · 7 comments

Comments

@EGrunzke
Copy link

On git bash for windows, pipenv shell results in command not found for most commands (python, git, ls, which, etc)

image
<Note: I know that python -V says 3.6.3 and the path says 3.6.0; I did an upgrade and never bothered to rename the directory>

Interestingly, in the windows command prompt pipenv shell works as expected.
image

I think the problem is in the PATH. Here's the path before and after pipenv shell

Grunzkes@Pantheon MINGW64 /c/dev/charmspace/iq-api (master)
$ echo $PATH$
/c/Users/Grunzkes/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Grunzkes/bin:/c/ProgramData/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/apps/python/3.6.0:/c/apps/python/3.6.0/scripts:/c/apps/nodejs/v7.9.0:/c/apps/Yarn/bin:/c/Program Files/gs/gs9.21/bin:/c/Program Files/gs/gs9.21/lib:/c/Users/Grunzkes/AppData/Local/Microsoft/WindowsApps:/c/apps/vs-code/bin:/c/Users/Grunzkes/AppData/Roaming/npm:/c/Users/Grunzkes/AppData/Local/Yarn/bin:/usr/bin/vendor_perl:/usr/bin/core_perl$

Grunzkes@Pantheon MINGW64 /c/dev/charmspace/iq-api (master)
$ pipenv shell

Grunzkes@Pantheon MINGW64 C:/dev/charmspace/iq-api
$ echo $PATH$
C:\Users\Grunzkes\.virtualenvs\iq-api-rSM3q15e\Scripts;C:\Users\Grunzkes\bin;C:\apps\Git\mingw64\bin;C:\apps\Git\usr\local\bin;C:\apps\Git\usr\bin;C:\apps\Git\usr\bin;C:\apps\Git\mingw64\bin;C:\apps\Git\usr\bin;C:\Users\Grunzkes\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\apps\python\3.6.0;C:\apps\python\3.6.0\scripts;C:\apps\nodejs\v7.9.0;C:\apps\Yarn\bin;C:\Program Files\gs\gs9.21\bin;C:\Program Files\gs\gs9.21\lib;C:\Users\Grunzkes\AppData\Local\Microsoft\WindowsApps;C:\apps\vs-code\bin;C:\Users\Grunzkes\AppData\Roaming\npm;C:\Users\Grunzkes\AppData\Local\Yarn\bin;C:\apps\Git\usr\bin\vendor_perl;C:\apps\Git\usr\bin\core_perl$

It appears that the path is being created in a windows format despite being in a bash shell. I say that based on:

  1. The separator changes from : to ; (Unix to Windows)
  2. The paths change from /c/ to C:\

Is there a flag or config to force unix-style PATH in pipenv shell?

Environment
  1. Windows 10
  2. Python 3.6.3
  3. pipenv, version 8.2.7
  4. git version 2.11.0.windows.1
@erinxocon
Copy link
Contributor

Hi @EGrunzke! Bash for Windows using MingWin isn't supported just yet. On windows we support the cmd console host emulator, the powershell terminal emulator, and the popular open source cmder terminal emulator. I think pipenv is getting confused becasue of the windows paths in a unix-y environment. I would recomend you try out one of the other shells, especially cmder as it has many wonderful features including bash like scripting inside of powershell!

@niks-git
Copy link

I also faced similar issue on my GIT bash shell (version 2.7.3). Updating the shell to latest version did not help. What finally worked for me was manually editing the $PATH variable. Here's what i did:

echo $PATH
(Copy the original unix style path)

pipenv shell
echo $PATH
(Copy the modified portion of the path which is now in Windows style, and paste it upfront of the older path. Make sure you make it unix style compatible)

export PATH="new-path-created-above"

This worked for me.

@spencertollefson
Copy link

@niks-git - your workaround solution worked for me, thanks! Unfortunately, it seems that the procedure is needed each timepipenv shell is commanded.

Could you or anyone else guide me into automating the procedure each time I run pipenv shell?

@shawnwall
Copy link

@erinxocon I would argue that git for windows, and mingwin are actually commonly used for terminal shells in Windows (especially for all of us coming from *nix/mac), and lacking support for it is a real problem.

@techalchemy
Copy link
Member

You should consider looking at more than one closed issue before commenting. We merged several PRs adding support for this and have split out an entire separate library to improve it further. These fixes will land in the next release.

@ociule
Copy link

ociule commented Jul 25, 2018

I had this bug with pipenv 2018.5.18. A bypass that worked for me was to delete ~/.bashrc. That meant I lose any customization of bash, but the PATH worked.

Updating to 2018.7.1 fixed it for good.

@alecigne
Copy link

alecigne commented Sep 24, 2018

I also have this problem. export PATH=$(echo $PATH | sed 's_C:/Users_/c/Users_g') fixes it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants