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.
https://pyenv-win.github.io/pyenv-win
MIT License
4.39k stars 416 forks source link

bug: pyenv install fails with: error extracting the embedded portion from the installer #532

Open umer-telenordigital opened 1 year ago

umer-telenordigital commented 1 year ago

We are using the teamcity build runner to install python with pyenv, it uses this repo to install pyenv-win, the version of pyenv it installs is 3.1.1

Steps to reproduce the behaviour:

  1. Create a build step in Teamcity to install python
  2. Specify any version, we have tested with 3.10.4
  3. Run it on a windows 10 or 11 machine
  4. It fails with this error: :: [Installing] :: 3.10.4 ... 14:54:24 :: [Error] :: error extracting the embedded portion from the installer. 14:54:24 :: [Error] :: couldn't install 3.10.4 14:54:24 pyenv specific python requisite didn't meet. Project is using different version of python.

Moreover, it can reproduced like this:

  1. RDP into the machine, open a command prompt
  2. Go to: C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\bin;
  3. Type pyenv install 3.10.4
  4. it fails with a popup message (screenshot attached)

Expected Behaviour: It should install the required python version without any issues

Screenshots image

Desktop (please complete the following information):

Additional context Full log can be see here: Download and install pyenv-win (Windows) (Command Line) 14:54:22  Build step condition "teamcity.agent.jvm.os.name contains Windows" is satisfied 14:54:22  Content of C:\TeamCity\temp\agentTmp\custom_script4186430415501646906.cmd file: @echo off rem This is a custom script written by TeamCity using windows-1252 charset. echo "##teamcity[setParameter name='env.Path' value='C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\bin;C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\shims;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\tools\ruby27\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Zabbix Agent 2\;C:\ProgramData\chocolatey\bin;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\gnupg\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\nodejs\;C:\Program Files\Cppcheck;C:\Program Files\Perforce\;C:\Windows\Program Files\Git\bin\git;C:\Program Files\dotnet\;C:\Program Files (x86)\SCE\Prospero SDKs\6.000\host_tools\bin;C:\Program Files (x86)\SCE\Prospero\Tools\Publishing Tools\bin;C:\Program Files (x86)\SCE\Common\SceVSI-VS17\bin;C:\Program Files (x86)\SCE\Common\SceVSI-VS16\bin;C:\Program Files\OpenSSH;C:\Program Files\OpenSSH;C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\bin;C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\shims;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\CMake\bin']" powershell -command "Invoke-WebRequest -UseBasicParsing -Uri \"https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1\" -OutFile \"./install-pyenv-win.ps1\"; &\"./install-pyenv-win.ps1\"" 14:54:22  Starting: C:\TeamCity\temp\agentTmp\custom_script4186430415501646906.cmd 14:54:22  in directory: C:\TeamCity\work\37ce35e9cf26ae2 14:54:23  " 14:54:23  ##teamcity[setParameter name='env.Path' value='C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\bin;C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\shims;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\tools\ruby27\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Zabbix Agent 2\;C:\ProgramData\chocolatey\bin;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\gnupg\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\nodejs\;C:\Program Files\Cppcheck;C:\Program Files\Perforce\;C:\Windows\Program Files\Git\bin\git;C:\Program Files\dotnet\;C:\Program Files (x86)\SCE\Prospero SDKs\6.000\host_tools\bin;C:\Program Files (x86)\SCE\Prospero\Tools\Publishing Tools\bin;C:\Program Files (x86)\SCE\Common\SceVSI-VS17\bin;C:\Program Files (x86)\SCE\Common\SceVSI-VS16\bin;C:\Program Files\OpenSSH;C:\Program Files\OpenSSH;C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\bin;C:\Windows\system32\config\systemprofile.pyenv\pyenv-win\shims;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\CMake\bin'] 14:54:23  " 14:54:23  pyenv-win 3.1.1 installed. 14:54:23  No updates available. 14:54:23  Process exited with code 0 14:54:23  Step 2/6: Download and install python (Windows) (Command Line) 14:54:23  Build step condition "teamcity.agent.jvm.os.name contains Windows" is satisfied 14:54:23  Content of C:\TeamCity\temp\agentTmp\custom_script8469091612889593645.cmd file: @echo off rem This is a custom script written by TeamCity using windows-1252 charset. pyenv install 3.10.4 && pyenv local 3.10.4 14:54:23  Starting: C:\TeamCity\temp\agentTmp\custom_script8469091612889593645.cmd 14:54:23  in directory: C:\TeamCity\work\37ce35e9cf26ae2 14:54:24  :: [Info] :: Mirror: https://www.python.org/ftp/python 14:54:24  :: [Installing] :: 3.10.4 ... 14:54:24  :: [Error] :: error extracting the embedded portion from the installer. 14:54:24  :: [Error] :: couldn't install 3.10.4 14:54:24  pyenv specific python requisite didn't meet. Project is using different version of python. 14:54:24  Install python '3.10.4' by typing: 'pyenv install 3.10.4' 14:54:24  Process exited with code 1 14:54:24  Process exited with code 1 (Step: Install Python / Download and install python (Windows) (Command Line)) 14:54:24  Step Download and install python (Windows) (Command Line) failed

Darsstar commented 1 year ago

Does clicking "Yes" on the pop-up provide additional information? dark.exe is a .NET application from the WiX toolset which we use to extract some of the .MSI files from the installer.

umer-telenordigital commented 1 year ago

Some Microsoft help pages

igorrafael commented 5 months ago

You probably ran the installer as a system user and your runner (correctly) does not have permission to write to C:\Windows\system32\. I had similar issues when trying to automate pyenv installation using Chocolatey and now am looking for the binaries in %UserProfile%\.pyenv-win\ instead of relying on the binaries on the system path - manually installing them if not present. Alternatively, you can make sure your agent setup uses the same user account as the runner.

igorrafael commented 5 months ago

This could potentially also be addressed with an environment variable after #579 is fixed