New permissions errors while running `pip install --upgrade pip` on Windows

I have an Actions pipeline that’s been running successfully for some time, across Windows, Ubuntu, and macOS. The first few steps run like this:

- uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v1
          python-version: '3.8'
      - name: Update Pip
        shell: bash
        run: |
          pip install --upgrade pip

In the last day or two, all Windows builds have started failing with this error

Collecting pip
  Downloading pip-20.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Uninstalling pip-20.0.2:
      Successfully uninstalled pip-20.0.2
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pip-uninstall-j2nlmzcm\\pip.exe'
Consider using the `--user` option or check the permissions.

##[error]Process completed with exit code 1.

Do I need to be creating a venv now? I looked through the Python Actions docs again and what I’m doing appears to be in line with the examples.

Apparently on Windows it’s now necessary to invoke as python -m pip to avoid permissions errors:

python -m pip install --upgrade pip

Hi @davidmreed ,

Yes, if you follow the error indication, add ‘–user’ for the command, it will tell you more info as below:

And use command ’ python -m pip install --upgrade pip’ will upgrade pip successfully on windows runner.


1 Like