Windows: Python, `pip` module not found?

Heads up I’m not a Windows user by any means so could be totally lost here.

Here is an example build that demonstrates the issue:
https://travis-ci.org/goodboy/tractor/jobs/597972125

This yaml setup used to work just fine like a day ago?

It also appears I’m not the only one seeing this.

I tried adding python -m ensurepip to the before_install steps and got this failed build instead.

Not sure what else I’m missing at this point. pip seems like a pretty key package that used to work just fine on these images.

Looks like this is something to do with trying to use a specific version of Python (was trying to force 3.7 but 3.8 [latest] seems to be getting installed)?

It’s odd because the docs on this seem to suggest that what I am doing is ok?

Seems to work once I don’t hardcode the version into the Python path being used but then the tests run on 3.8 which is not desired (yet).

You can force a specific version with choco install --version:

choco install python --version 3.7.5

The example in the docs is not bulletproof. It worked when it was written and 3.8 was released 2 days ago. You can suggest an improvement using the “Improve this page on Github” button.

Today you’ll get an error from 3.7.5 (which came out on 10/15/19). Might work tomorrow. 3.7.4 will work though.

You can use 3.8 pretty easily without refreshenv. Set an env with the 3.8 PATH:

os: windows
language: shell
env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
before_install:
- choco install python
- python -m pip install -r requirements/ci.txt

Sweet thanks for the tip on running 3.7 @YakDriver and @native-api.

I actually just made one job run whatever is latest python 3.x which avoids hard coding any $PATH stuff afaict.

I’m gonna try the --version flag to choco and see what I get for keeping a 3.7 run on windows.

For the extra lolz, apparently choco install python versus python3 matters:

with just python it’s rekt:
https://travis-ci.org/goodboy/tractor/builds/598943087

versus with python3 everything’s fine:
https://travis-ci.org/goodboy/tractor/builds/598939313

Check the configs; that’s the only difference.

Note that I wrote python, not python3. These are different packages and for python, 3.7.5 is already available. Check available versions with choco list -e -a <package name>.

The logs show that python3 always installs to C:\Python while python installs to C:\PythonXY.

That’s good information. Thanks!

Summary, choco install python vs. choco install python3:

python

  • New versions might be available sooner (or at least different times than python3)
  • Installs Python to C:\PythonXY
  • Requires either refreshenv or setting PATH (or using full path in using Pip and Python)

python3

  • New versions might be available later (or at least different times than python)
  • Installs Python to C:\Python
  • Requires either refreshenv or setting PATH (or using full path in using Pip and Python)

Exactly the same problem but two years later. These commands used to work on Windows this morning, and now not anymore:

choco install python --version 3.7.5
python -m ensurepip
python -m pip install --upgrade pip

Now the last command fails with the error message:
No module named pip