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.12.x install only works when executed twice on windows #969

Open
3 tasks
OhioDschungel6 opened this issue Oct 23, 2024 · 3 comments
Open
3 tasks
Assignees
Labels
bug Something isn't working

Comments

@OhioDschungel6
Copy link

Description:
When executed on an enterprise windows runner. The first run with a version always fails, while the second and subsequent runs with this version succeeds.

Minimal setup:

jobs:
  "test":
    runs-on: [ Windows]
    steps:
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.12.5

If the version is changed to 3.12.6, the first run will fail. Same if the version is changed the other way around.

Example: Previous version 3.12.5, new version 3.12.6
First the setup.ps1 is deleting everything in %TOOLS$/Python/3.12.5/x64 (as it should) (the empty folder is not deleted) (line 95ff in setup.ps1)

Line 119f copies "python-3.12.6-amd64.exe" into %TOOLS$/Python/3.12.6/x64 (correct)

Now the error happens:
Line 125 executes cmd.exe /c "cd $PythonArchPath && call $PythonExecName $ExecParams /quiet"
While everything looks correct this will install python3.12.6 into the folder %TOOLS$/Python/3.12.5/x64.
As now %TOOLS$/Python/3.12.6/x64/python.exe does not exist, the symlink creation in line 132 does not work.

When executed again it will install python3.12.6 into %TOOLS$/Python/3.12.6/x64 and everything works.

I am not sure why this happens, but my only possible explanation is, that $ExecParams evaluates to "DefaultAllUsersTargetDir=$PythonArchPath InstallAllUsers=1" and "DefaultAllUsersTargetDir" doesnt work. Instead it will fall back to another dir which is set by the first run. I dont know why TargetDir is not used for non msi installers.

Action version:
actions/setup-python@v4

Platform:

  • Ubuntu
  • macOS
  • [x ] Windows

Runner type:

  • Hosted
  • [x ] Self-hosted

Tools version:
Confirmed for 3.12.x, but i don't know if others are affected.

Expected behavior:
The first run should work and install python into the correct directory.

Actual behavior:
Python 3.12.6 is installed into the directory version of the old python 3.12.5

@OhioDschungel6 OhioDschungel6 added bug Something isn't working needs triage labels Oct 23, 2024
@priyagupta108
Copy link
Contributor

Hi @OhioDschungel6 👋,
Thank you for your report. We'll investigate the issue and get back to you with the details!

@mahalakshmi-rekadi
Copy link

Hello @OhioDschungel6 ,
We attempted to reproduce the issue but we are able to successfully install the Python 3.12.x on the first run. Please refer to the attached screenshot for details.

The DefaultAllUsersTargetDir parameter is part of the installation command for non-MSI installers. If the directory specified by this parameter is not accessible or has permission issues during the first run, it might cause the installer to fall back to a different directory. This could explain why the installation succeeds on the second attempt when the directory is available or permissions are resolved.

The Get-ExecParams function in the win-setup-template.ps1 script uses TARGETDIR for MSI installers and DefaultAllUsersTargetDir for non-MSI installers. The choice of parameters is based on the installation requirements:
1.MSI Installers: Use the TARGETDIR property to specify the installation directory.
2. Non-MSI Installers: Use the DefaultAllUsersTargetDir parameter as non-MSI installers may not support the TARGETDIR parameter. This ensures the installation path is set correctly for all users.

Make sure the directory specified by DefaultAllUsersTargetDir is accessible and has the correct permissions.
If you need any further assistance, please feel free to reach out.

Screenshot 2024-11-01 at 6 12 27 PM Screenshot 2024-11-01 at 6 13 23 PM

@mahalakshmi-rekadi
Copy link

Hello @OhioDschungel6 , We are awaiting for your response on the issue. Please let us know if we can close this issue if there are no further queries.

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