'Choco install python' fails on AppVeyor with 1603

Question:

I have a PowerShell build script that installs Python from Chocolatey:

choco install python -y

But even though it works on local machines, running it on AppVeyor will fail half-silently:

[00:01:07] Chocolatey v0.10.3
[00:01:07] Installing the following packages:
[00:01:07] python
[00:01:07] By installing you accept licenses for the packages.
[00:01:08]
[00:01:08] python3 v3.6.0 [Approved]
[00:01:08] python3 package files install completed. Performing other installation steps.
[00:01:09] Downloading python3 64 bit
[00:01:09]   from 'https://www.python.org/ftp/python/3.6.0/python-3.6.0-amd64.exe'
[00:01:09]
[00:01:09] Progress: 0% - Saving 26.78 KB of 30.05 MB (27420/31505640)
... *download info*
[00:01:10] Progress: 100% - Completed download of C:UsersappveyorAppDataLocalTempchocolateypython33.6.0python-3.6.0-amd64.exe (30.05 MB).
[00:01:10] Download of python-3.6.0-amd64.exe (30.05 MB) completed.
[00:01:13] Hashes match.
[00:01:13] Installing python3...
[00:01:51] ERROR: Running ["C:UsersappveyorAppDataLocalTempchocolateypython33.6.0python-3.6.0-amd64.exe" /quiet InstallAllUsers=1 PrependPath=1 TargetDir="C:Python36" ] was not successful. Exit code was '1603'. See log for possible error messages.
[00:01:52] The install of python3 was NOT successful.
[00:01:52] Error while running 'C:ProgramDatachocolateylibpython3toolschocolateyInstall.ps1'.
[00:01:52]  See log for details.
[00:01:54]
[00:01:54] python v3.6.0 [Approved]
[00:01:54] python package files install completed. Performing other installation steps.
[00:01:54]  The install of python was successful.
[00:01:54]   Software install location not explicitly set, could be in package or
[00:01:54]   default install location if installer.
[00:01:54]
[00:01:54] Chocolatey installed 1/2 packages. 1 packages failed.
[00:01:54]  See the log for details (C:ProgramDatachocolateylogschocolatey.log).
[00:01:54]
[00:01:54] Failures
[00:01:54]  - python3 (exited 1603) - Error while running 'C:ProgramDatachocolateylibpython3toolschocolateyInstall.ps1'.
[00:01:54]  See log for details.
[00:01:54] 2016-03-28 11:31:39,117 [DEBUG] - Configured chocolatey.infrastructure.logging.log4net.config.xml from assembly choco, Version=0.9.9.12, Culture=neutral, PublicKeyToken=79d02ea9cad655eb
... *unrelated*

The log doesn’t tell me anything useful. Is this a bug from Chocolatey, a problem with the package or, hopefully, something wrong with the VM environment?

Asked By: villasv

||

Answers:

Installer returned Exit code was '1603'.


From Microsoft documentation:

You may receive this error message if any one of the following conditions is true:

  • Windows Installer is attempting to install an app that is already installed on your PC.
  • The folder that you are trying to install the Windows Installer package to is encrypted.
  • The drive that contains the folder that you are trying to install the Windows Installer package to is accessed as a substitute drive.
  • The SYSTEM account does not have Full Control permissions on the folder that you are trying to install the Windows Installer package to. You notice the error message because the Windows Installer service uses the SYSTEM account to install software.

The most likely cause of the error is that the installer was not run by a user which has required permissions.

Answered By: agabrys

Python 3.6 is already installed on build workers into the same C:Python36 location: https://www.appveyor.com/docs/installed-software/#python

Answered By: Feodor Fitsner

Solved this by first uninstalling all python 3 versions, then using chocolatey

chocolatey install python -y --force
Answered By: Karl

To prevent chocolatey from trying to install python in future, you can use:

choco pin -n=python
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.