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

Python 3.10+ on Windows x86 architecture doesn't have the Scripts folder on path #1005

Open
2 of 5 tasks
Avasam opened this issue Jan 8, 2025 · 4 comments
Open
2 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@Avasam
Copy link

Avasam commented Jan 8, 2025

Description:
When pip installing a library that adds console scripts on Python 3.10+ on Windows x86, I get the following message:

WARNING: The scripts <> and <> are installed in 'C:\Users\runneradmin\AppData\Roaming\Python\Python3XX-32\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

See this action run at this specific line for example: https://github.com/mhammond/pywin32/actions/runs/12664473637/job/35292676675?pr=2408#step:5:3578

This doesn't see to affect x64 self-hosted runners or Python 3.9 and under.

I'm not 100% certain where the issue lies, but I'm assuming that this path not being added to PATH lies with setup-python
I couldn't find anything in Python 3.10's changelog indicating that this is an intended change within official Python installers themselves (no idea if this would happen with a local install)

Action version:
v5

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

3.10, x86
3.11, x86
3.12, x86
3.13, x86

Repro steps:
Run the actions of this commit (permalink): https://github.com/Avasam/pywin32/blob/61e4698/.github/workflows/main.yml

Expected behavior:
C:\Users\runneradmin\AppData\Roaming\Python\Python310-32\Scripts to be present on path, no warning and scripts are accessible

Actual behavior:

Installing collected packages: pywin32
  WARNING: The scripts pywin32_postinstall.exe and pywin32_testall.exe are installed in 'C:\Users\runneradmin\AppData\Roaming\Python\Python310-32\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
@aparnajyothi-y
Copy link
Contributor

Hello @Avasam, Thank you for creating this issue and we will look into it :)

@mahabaleshwars mahabaleshwars self-assigned this Jan 9, 2025
@Avasam
Copy link
Author

Avasam commented Jan 19, 2025

I am temporarily working around this issue with the following step:

      - name: Fix user Scripts missing from PATH
        if: matrix.architecture == 'x86'
        run: |
          # Work around https://github.com/actions/setup-python/issues/1005
          $ScriptsPath = python -c "import sysconfig,os; print(sysconfig.get_path('scripts', f'{os.name}_user'))"
          echo $ScriptsPath
          Add-Content $env:GITHUB_PATH $ScriptsPath

@aparnajyothi-y
Copy link
Contributor

Hello @Avasam, Thank you for your patience as we worked through this issue. Here’s an explanation of why the warning appears during the installation of PyInstaller, but not for pywin32:

When the PyInstaller package is installed with the --user flag, the following warning appears:
WARNING: The scripts pyi-archive_viewer.exe, pyi-bindepend.exe, pyi-grab_version.exe, pyi-makespec.exe, pyi-set_version.exe, and pyinstaller.exe are installed in C:\Users\runneradmin\AppData\Roaming\Python\Python310-32\Scripts, which is not on PATH.
Consider adding this directory to PATH, or if you prefer to suppress this warning, use --no-warn-script-location.
This happens because the directory where these scripts are installed is not included in the system's PATH environment variable. As a result, the system cannot automatically locate these executables, prompting pip to issue the warning.

This behavior is expected when installing Python packages with the --user flag as per the official Python documentation on --user flag.

The user-specific installation directory is typically located in ~/.local/ (on Linux/macOS) or %APPDATA%\Python (on Windows). For further details on where this directory is and how it works, you can refer to the Python documentation here.

We can address the warning in one of two ways:

  1. Add the directory to the system’s PATH environment variable, or

For guidance on modifying the PATH variable, see the Python documentation for User Installation Path.

  1. Suppress the warning by using the --no-warn-script-location flag during installation, which tells pip not to warn you about script locations. more about this in pip’s command-line options here:

pip install --no-warn-script-location

In our basic workflow, we did not encounter this warning because the script locations were likely already included in the correct PATH, or it could be due to differences in the environment (e.g., virtual environments or the default system setup). However, the warning appeared in your case when using the --user flag due to the specific installation method and the location of the scripts.

I’ve also attached screenshots for reference to illustrate this.

I hope this clarifies the situation. Please let us know if you need any further assistance!

@Avasam
Copy link
Author

Avasam commented Jan 23, 2025

Thanks for the response @aparnajyothi-y . I don't need to, or intend to, suppress the pip warning as it is merely a symptom and a helpful message that helped me find my issue.

The core issue I have is not being able to run installed Python scripts on the CI for Python 3.10+ on x86 architecture specifically. (at least not without a workaround as I have shared above)

I would ask for setup-python to ensure that the ...\Python\Python3XX-32\Scripts folder is added to path during installation and setup.

I can see that https://docs.python.org/3/library/sysconfig.html#nt-user does not mention the -32 suffix. If you think that is out of spec and that setup-python should not support it, then let's find who is responsible for setting that as the scripts path and raise an issue there (stdlib? pip? setuptools?).

Do note that I verified, by printing the result of sysconfig.get_path('scripts', f'{os.name}_user') in the CI, that this issue doesn't seem to happen on Python 3.9 and below because -32 isn't appended to the path then.
https://github.com/mhammond/pywin32/actions/runs/12849740577/job/35828625751?pr=2408#step:5:14


PS.: The link you shared https://docs.python.org/3/install/index.html#custom-installation is not valid (404 Not Found)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants