Zulip Chat Archive

Stream: Berkeley Lean Seminar

Topic: windows python / git bash problem


Emily Bain (May 29 2020 at 21:13):

https://superuser.com/questions/1403345/git-bash-not-running-python3-as-expected-hanging-issues I am having roughly this issue

Patrick Lutz (May 29 2020 at 21:14):

After you set App Installer python.exe and App Installer python3.exe to off what did you do?

Emily Bain (May 29 2020 at 21:14):

2020-05-29-2.png

Emily Bain (May 29 2020 at 21:15):

Patrick Lutz said:

After you set App Installer python.exe and App Installer python3.exe to off what did you do?

I spent like 10 minutes trying to find where python was actually installed and then added a line to my bashrc adding it to the python path

Emily Bain (May 29 2020 at 21:16):

I'm not really used to windows

Thomas Browning (May 29 2020 at 21:17):

one extreme option would be to uninstall python and reinstall

Patrick Lutz (May 29 2020 at 21:19):

I'm slightly confused about what you've done so far. Can you just list everything you did after changing the app execution aliases settings?

Patrick Lutz (May 29 2020 at 21:19):

also did you restart git bash after changing those settings?

Patrick Lutz (May 29 2020 at 21:20):

I'm not really used to windows

what do you normally use?

Emily Bain (May 29 2020 at 21:21):

First I updated python actually through the installer which is linked. And then added this to .bashrc

export  PATH="$PATH:C:\Users\elbai\AppData\Local\Programs\Python\Python38-32"

Emily Bain (May 29 2020 at 21:21):

Patrick Lutz said:

also did you restart git bash after changing those settings?

yes. I have to kill it every time I try to run python from it anyway...

Emily Bain (May 29 2020 at 21:22):

Patrick Lutz said:

I'm not really used to windows

what do you normally use?

I've always used some sort of linux for programming, but now I have a windows laptop (I rarely program now)

Patrick Lutz (May 29 2020 at 21:22):

ctrl-C doesn't kill it?

Emily Bain (May 29 2020 at 21:23):

Patrick Lutz said:

ctrl-C doesn't kill it?

no

Patrick Lutz (May 29 2020 at 21:23):

okay, so you got command not found and added python to your path

Patrick Lutz (May 29 2020 at 21:24):

but now python causes your terminal to hang

Patrick Lutz (May 29 2020 at 21:24):

is that right?

Emily Bain (May 29 2020 at 21:25):

Patrick Lutz said:

okay, so you got command not found and added python to your path

Actually I get

$ which python
which: no python in (/c/Users/elbai/.elan/bin:/c/Users/elbai/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/elbai/bin:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS:/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Program Files (x86)/Wolfram Research/WolframScript:/cmd:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS:/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/windows/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Users/elbai/AppData/Local/Microsoft/WindowsApps:%DASHLANE_DLL_DIR%:/c/Python34/Scripts:/c/Users/elbai/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl)

before sourcing .bashrc

Emily Bain (May 29 2020 at 21:25):

Patrick Lutz said:

but now python causes your terminal to hang

yes

Thomas Browning (May 29 2020 at 21:26):

did you add python to the windows path?

Emily Bain (May 29 2020 at 21:26):

Thomas Browning said:

did you add python to the windows path?

er... probably not. How do I do that?

Patrick Lutz (May 29 2020 at 21:27):

https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

Patrick Lutz (May 29 2020 at 21:27):

good point Thomas

Emily Bain (May 29 2020 at 21:27):

ok I'll try this, thanks!

Rikhav Shah (May 29 2020 at 21:28):

you'll need to locate python on your computer

Rikhav Shah (May 29 2020 at 21:29):

Its likely in C:\Users\yourusername\AppData\Local\Programs\Python\Python3x

Emily Bain (May 29 2020 at 21:31):

So adding python to my windows path saves me from sourcing .bashrc each time but otherwise no change

Patrick Lutz (May 29 2020 at 21:32):

hmm

Rikhav Shah (May 29 2020 at 21:32):

it actually does make a difference because other packages will use your windows path variable

Patrick Lutz (May 29 2020 at 21:33):

Which version of Windows are you using?

Emily Bain (May 29 2020 at 21:33):

Rikhav Shah said:

it actually does make a difference because other packages will use your windows path variable

What I mean is that it hasn't solved my immediate problem. I know it needs to be done anyway!

Emily Bain (May 29 2020 at 21:33):

Patrick Lutz said:

Which version of Windows are you using?

Windows 10

Thomas Browning (May 29 2020 at 21:35):

just so that I understand, what happens when you run
cp "$(which python)" "$(which python)"3
in the git bash?

Emily Bain (May 29 2020 at 21:36):

elbai@DESKTOP-1E616F8 MINGW64 ~
$ –cp "$(which python)" "$(which python)"3
bash: $'\302\226cp': command not found

Patrick Lutz (May 29 2020 at 21:36):

How about just which python?

Emily Bain (May 29 2020 at 21:37):

elbai@DESKTOP-1E616F8 MINGW64 ~
$ which python
/c/Users/elbai/AppData/Local/Programs/Python/Python38-32/python

Emily Bain (May 29 2020 at 21:38):

also python -i works as expected

Emily Bain (May 29 2020 at 21:39):

and python works fine in windows powershell

Emily Bain (May 29 2020 at 21:39):

and pycharm

Thomas Browning (May 29 2020 at 21:40):

what happens when you type "python3" in the git bash?

Emily Bain (May 29 2020 at 21:40):

elbai@DESKTOP-1E616F8 MINGW64 ~
$ python3
bash: python3: command not found

Rikhav Shah (May 29 2020 at 21:40):

it might be worth saying that i just use command prompt for python with no problems, but git bash hangs when i use it

Emily Bain (May 29 2020 at 21:41):

yeah I'm pretty sure it's a git bash problem, based on my google searches

Emily Bain (May 29 2020 at 21:41):

but other people have fixed it with winpty, which is just weird for me

Emily Bain (May 29 2020 at 21:42):

if I were to go ahead with the instructions using powershell or command prompt instead, would I run into any problems?

Thomas Browning (May 29 2020 at 21:42):

could you try skipping to "configure git" in the instructions?

Patrick Lutz (May 29 2020 at 21:42):

Okay, I think I finally really understand your situation

Patrick Lutz (May 29 2020 at 21:42):

what happened after you ran winpty?

Emily Bain (May 29 2020 at 21:43):

Thomas Browning said:

could you try skipping to "configure git" in the instructions?

Just ran git config --global core.autocrlf input. Was it supposed to do something? What do the instructions mean by "you can set it to false?"

Emily Bain (May 29 2020 at 21:43):

Patrick Lutz said:

what happened after you ran winpty?

it appears to do nothing but everything I type after is invisible

Thomas Browning (May 29 2020 at 21:44):

what if you skip to "get scripts"

Emily Bain (May 29 2020 at 21:44):

elbai@DESKTOP-1E616F8 MINGW64 ~
$ winpty python

elbai@DESKTOP-1E616F8 MINGW64 ~
$ bash: I am invisible: command not found

elbai@DESKTOP-1E616F8 MINGW64 ~
$ why is this happening

Emily Bain (May 29 2020 at 21:45):

Thomas Browning said:

what if you skip to "get scripts"

elbai@DESKTOP-1E616F8 MINGW64 ~
$ pip3 install mathlibtools
bash: pip3: command not found

Unsurprising I suppose given that it doesn't even know what python3 is

Thomas Browning (May 29 2020 at 21:46):

what if you do "pip3 install mathlibtools" in the command prompt

Emily Bain (May 29 2020 at 21:47):

C:\Users\elbai>pip3 install mathlibtools
'pip3' is not recognized as an internal or external command,
operable program or batch file.

Emily Bain (May 29 2020 at 21:48):

command prompt also doesn't know what python3 is though

Thomas Browning (May 29 2020 at 21:49):

I feel like that's a PATH issue

Patrick Lutz (May 29 2020 at 21:49):

elbai@DESKTOP-1E616F8 MINGW64 ~
$ –cp "$(which python)" "$(which python)"3
bash: $'\302\226cp': command not found

This seems really bizarre. But maybe you can try to manually do this step?

Thomas Browning (May 29 2020 at 21:50):

command prompt not knowing python3 shouldn't have anything to do with the git bash

Emily Bain (May 29 2020 at 21:50):

Thomas Browning said:

I feel like that's a PATH issue

yeah probably - I haven't been trying to get command prompt to work

Emily Bain (May 29 2020 at 21:51):

it knows python, and python is python 3. Although it doesn't know pip and I have pip.

Patrick Lutz (May 29 2020 at 21:51):

you need to add pip to PATH too I think

Thomas Browning (May 29 2020 at 21:53):

Patrick Lutz said:

you need to add pip to PATH too I think

That sounds reasonable to me. And then try "pip3 install mathlibtools" or "pip install mathlibtools"

Rikhav Shah (May 29 2020 at 21:55):

if pip and pip3 dont work, you can just do python -m pip install mathlibtools

Patrick Lutz (May 29 2020 at 21:56):

Emily, what happens when you try winpty python.exe?

Patrick Lutz (May 29 2020 at 21:56):

in git bash?

Emily Bain (May 29 2020 at 21:56):

Thomas Browning said:

Patrick Lutz said:

you need to add pip to PATH too I think

That sounds reasonable to me. And then try "pip3 install mathlibtools" or "pip install mathlibtools"

it's installing. Can I just never use git bash?

Patrick Lutz (May 29 2020 at 21:57):

probably

Emily Bain (May 29 2020 at 21:57):

Patrick Lutz said:

Emily, what happens when you try winpty python.exe?

same

elbai@DESKTOP-1E616F8 MINGW64 ~
$ winpty python.exe

elbai@DESKTOP-1E616F8 MINGW64 ~
$ no I am still invisible

Patrick Lutz (May 29 2020 at 21:58):

I think the instructions only directed you to use git bash to make sure unix style commands will work

Patrick Lutz (May 29 2020 at 21:58):

but it should be possible to do everything in the windows shell

Kyle Miller (May 29 2020 at 21:59):

can you do echo $PATH? I'm suspicious of those backslashes because they might be interpreted as escape codes. (I haven't read to intervening messages too closely). Windows allows forward slashes for directory separators

Kyle Miller (May 29 2020 at 22:00):

For example, \e is ascii 127, I think

Patrick Lutz (May 29 2020 at 22:00):

I need to go for a bit. I'll come back later in case there's still a problem (though I don't really know what I'm doing because I rarely use windows)

Emily Bain (May 29 2020 at 22:00):

Kyle Miller said:

can you do echo $PATH? I'm suspicious of those backslashes because they might be interpreted as escape codes. (I haven't read to intervening messages too closely). Windows allows forward slashes for directory separators

It looks ok

/c/Users/elbai/.elan/bin:/c/Users/elbai/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/elbai/bin:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS:/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Program Files (x86)/Wolfram Research/WolframScript:/cmd:/c/Users/elbai/AppData/Local/Programs/Python/Python38-32:/c/Users/elbai/AppData/Local/Programs/Python/Python38-32/Scripts:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS:/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/windows/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Users/elbai/AppData/Local/Microsoft/WindowsApps:/c/Users/elbai/AppData/Roaming/Dashlane/6.1907.0.17833/bin/Firefox_Extension/{442718d9-475e-452a-b3e1-fb1ee16b8e9f}/components:/c/Users/elbai/AppData/Roaming/Dashlane/6.1907.0.17833/ucrt:/c/Users/elbai/AppData/Roaming/Dashlane/6.1907.0.17833/bin/Qt:/c/Users/elbai/AppData/Roaming/Dashlane/6.1907.0.17833/bin/Ssl:/c/Python34/Scripts:/c/Users/elbai/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl

Kyle Miller (May 29 2020 at 22:02):

I see, /c/Users/elbai/AppData/Local/Programs/Python/Python38-32 is successfully in your path

Kyle Miller (May 29 2020 at 22:04):

(I don't have experience with this, but you might try https://oleanstorage.azureedge.net/releases/bundles/trylean_windows.zip since it's an all-in-one bundle. Another option is to create a virtual machine running linux and install things there...)

Patrick Lutz (May 29 2020 at 22:05):

Seems like there are some similar issues here: https://github.com/microsoft/vscode/issues/45693

Kevin Buzzard (May 29 2020 at 22:10):

So just to comment that on the super-detailed Lean installation instructions for Windows, if people follow them to the absolute letter then it seems to work. Is that not what is happening here? The moment someone installs a version of python which isn't the one suggested, or a shell which isn't the one suggested, then there can be problems. I don't know anything about Windows but what I'm trying to say is that one possibility might be to follow the instructions to the letter, if that is not what you have already done

Kevin Buzzard (May 29 2020 at 22:11):

https://leanprover-community.github.io/install/windows.html

Kevin Buzzard (May 29 2020 at 22:12):

I guess that if you followed them to the letter, and still have problems, then people would like to hear about it on the main chat (perhaps after Patrick Massot has gone to bed, because stuff like this makes his blood boil); it's gone midnight in France though and he has small kids so you shouldn't have to wait for long)

Emily Bain (May 29 2020 at 22:20):

So I already had python installed, which may have messed things up. But it also seems that there is a known bug with git bash and python on Windows 10 specifically. The solution given in this stack overflow post doesn't work for me however: https://stackoverflow.com/questions/32597209/python-not-working-in-the-command-line-of-git-bash.

I can make a post in the main chat if you think this counts as following the instructions to the letter!

Kevin Buzzard (May 29 2020 at 22:24):

Oh :-( Of course I was hoping you'd say "oh yeah, paragraph 5 subsection 3 of that page -- it's now all working". I am really sorry that you cannot get this Microsoft product running on your Microsoft operating system; it drives me mad that MS don't just make some all-singing all-dancing one-click installer, but they have somehow abandoned Lean 3 (they're working on Lean 4). The community does its best and it is miserable that there are still Windows users experiencing issues. I would definitely ask on the main chat -- there are some experienced Lean CS people out there, and most people out there are not subscribed to this Berkeley chat. I would definitely mention that you carefully followed the instructions in your post because that's the first thing they'll ask.

Emily Bain (May 29 2020 at 22:29):

Windows never works quite as you'd like it to! I just installed an ubuntu terminal on windows (apparently this is a thing now) and I am going to see how that goes. I'll make a post on the main chat about my issue with git bash.

Emily Bain (May 29 2020 at 22:40):

Well I've managed to get myself an alias for python3 somehow. The only thing I can't do now is actually run python from git bash...


Last updated: Dec 20 2023 at 11:08 UTC