Installing specific version of Python on Windows executor

Hello,

I’m trying to run a integration tests job on a windows executor.
Our application is using Python 3.7.0 so I’m trying to install this specific version using choco but failing to do so.

This is the output from the install command -

PS C:\> choco install python --version=3.7.0
choco install python --version=3.7.0
Chocolatey v1.0.1
Installing the following packages:
python
By installing, you accept licenses for the packages.
Progress: Downloading python 3.7.0... 100%

python3 v3.7.0 [Approved]
python3 package files install completed. Performing other installation steps.
Installing 64-bit python3...
WARNING: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\python3_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error.
ERROR: Running ["C:\ProgramData\chocolatey\lib\python3\tools\python-3.7.0-amd64.exe" /quiet InstallAllUsers=1 PrependPath=1 TargetDir="C:\Python37" ] was not successful. Exit code was '1603'. Exit code indicates the following: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\python3_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error..
The install of python3 was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\python3\tools\chocolateyInstall.ps1'.
 See log for details.

python v3.7.0 [Approved]
python package files install completed. Performing other installation steps.
 The install of python was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\python'

Chocolatey installed 1/2 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - python3 (exited 1603) - Error while running 'C:\ProgramData\chocolatey\lib\python3\tools\chocolateyInstall.ps1'.
 See log for details.

I also tried to first uninstall using choco or do choco upgrade but all of these attempts has failed as well.
Also when I tried to run it with --install-arguments="'/l*v c:\python3_msi_install.log'" it did not generate the log file so I’m not sure what exactly is the issue.

Any ideas how can resolve this issue?

Thanks,
Omer.

Succeeded to do so using pyenv-win - GitHub - pyenv-win/pyenv-win: pyenv for Windows. pyenv is a simple python version management tool. It lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.

And the step in the config that installs the pyenv and setting the default python version is as the following -

      - run:
          name: Install and set Python 3.7.0
          shell: powershell.exe
          command: |
            choco install pyenv-win --force
            refreshenv
            pyenv install 3.7.0
            pyenv global 3.7.0
            $env:Path = 'C:\Users\circleci\.pyenv\pyenv-win\bin;C:\Users\circleci\.pyenv\pyenv-win\shims;' + $env:Path
            python --version

Hopefully it will help to others who struggled with this issue as well.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.