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

%1 is not a valid Win32 application when installing packages #4508

Closed
wadetracy opened this issue Oct 29, 2020 · 8 comments
Closed

%1 is not a valid Win32 application when installing packages #4508

wadetracy opened this issue Oct 29, 2020 · 8 comments

Comments

@wadetracy
Copy link

Hey guys,

Just getting started with pipenv so please forgive any obvious gaffs...I installed everything awhile back and I'm just coming back to trying to use pipenv for a project. I could have sworn that everything worked before, but now when I create a new directory and run pipenv install numpy I get the following:

Creating a virtualenv for this project…                                                                                                                                    
Pipfile: C:\repos\test\Pipfile                                                                                                                                             
Using c:/users/wt255008/.pyenv/pyenv-win/shims/python (None) to create virtualenv…                                                                                         
[=== ] Creating virtual environment...RuntimeError: failed to query c:\users\wt255008\.pyenv\pyenv-win\shims\python with code 8 err: '%1 is not a valid Win32 application' 
                                                                                                                                                                           
Failed creating virtual environment                                                                                                                                        
                                                                                                                                                                           
[pipenv.exceptions.VirtualenvCreationException]:                                                                                                                           
Failed to create virtual environment.

It seems to imply an architecture mismatch but everything I'm using should be 64 bit and I've checked it as best as I know how and everything seems kosher.

If I run pipenv install numpy --python 3.7.7 I see this:

Creating a virtualenv for this project…
Pipfile: C:\repos\test\Pipfile
Using C:/Users/wt255008/.pyenv/pyenv-win/versions/3.7.7/python.exe (3.7.7) to create virtualenv…
[ ===] Creating virtual environment...OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\wt255008\\.virtualenvs\\test-oUeIiS9_-C:\\Users\\wt255008\\.pyenv\\pyenv-win\\shims\\python'

Failed creating virtual environment

[pipenv.exceptions.VirtualenvCreationException]:
Failed to create virtual environment.
'in' is not recognized as an internal or external command,
operable program or batch file.

I thought #4330 would help me so I followed the recommended step at the end of that discussion. It appears to be trying to append the python version by accessing the PIPENV_PYTHON environment variable but ends up with the path instead of the version number.

Here are my support results:

$ pipenv --support

Pipenv version: '2020.8.13.dev0'

Pipenv location: 'c:\\repos\\test-serverless\\src\\pipenv\\pipenv'

Python location: 'c:\\users\\wt255008\\.pyenv\\pyenv-win\\versions\\3.7.7\\python.exe'

Python installations found:

  • 3.8.3: C:\Python38\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.7',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.18362',
 'python_full_version': '3.7.7',
 'python_version': '3.7',
 'sys_platform': 'win32'}

System environment variables:

  • ADD_PATH
  • ALIASES
  • ALLUSERSPROFILE
  • ANSICON
  • ANSICON_DEF
  • APPDATA
  • ARCHITECTURE
  • ARCHITECTURE_BITS
  • ATLAS_HOME
  • CCALL
  • CEXEC
  • CHASSIS
  • CHOCOLATEYINSTALL
  • CHOCOLATEYLASTPATHUPDATE
  • CMDER_ALIASES
  • CMDER_CLINK
  • CMDER_CONFIGURED
  • CMDER_INIT_END
  • CMDER_INIT_START
  • CMDER_ROOT
  • CMDER_SHELL
  • CMDER_USER_FLAGS
  • COMMONPROGRAMFILES
  • COMMONPROGRAMFILES(X86)
  • COMMONPROGRAMW6432
  • COMPUTERNAME
  • COMSPEC
  • CONEMUANSI
  • CONEMUANSILOG
  • CONEMUARGS
  • CONEMUARGS2
  • CONEMUBACKHWND
  • CONEMUBASEDIR
  • CONEMUBASEDIRSHORT
  • CONEMUBUILD
  • CONEMUCFGDIR
  • CONEMUCONFIG
  • CONEMUDIR
  • CONEMUDRAWHWND
  • CONEMUDRIVE
  • CONEMUHOOKS
  • CONEMUHWND
  • CONEMUPALETTE
  • CONEMUPID
  • CONEMUSERVERPID
  • CONEMUTASK
  • CONEMUWORKDIR
  • CONEMUWORKDRIVE
  • DEBUG_OUTPUT
  • DEPTH
  • DRIVERDATA
  • FAST_INIT
  • FEFLAGNAME
  • FIND_QUERY
  • FOUND
  • GIT_EXECUTABLE
  • GIT_INSTALL_ROOT
  • GIT_LOCALE
  • GIT_VERSION_USER
  • GIT_VERSION_VENDORED
  • HOME
  • HOMEDRIVE
  • HOMEPATH
  • JAVA_HOME
  • LANG
  • LDMS_LOCAL_DIR
  • LDMS_PREFERRED_SERVER
  • LIB_BASE
  • LIB_CONSOLE
  • LIB_GIT
  • LIB_PATH
  • LIB_PROFILE
  • LOCALAPPDATA
  • LOGONSERVER
  • MAX_DEPTH
  • MODEL
  • NIX_TOOLS
  • NUMBER_OF_PROCESSORS
  • OLD_PATH
  • ONEDRIVE
  • ONEDRIVECOMMERCIAL
  • OS
  • PATH
  • PATHEXT
  • PATH_POSITION
  • PIPENV_PYTHON
  • PLINK_PROTOCOL
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMDATA
  • PROGRAMFILES
  • PROGRAMFILES(X86)
  • PROGRAMW6432
  • PROMPT
  • PSMODULEPATH
  • PUBLIC
  • PYENV
  • PYENV_HOME
  • SERIAL
  • SESSIONNAME
  • SVN_SSH
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TEMP
  • TERM
  • TIME_INIT
  • TMP
  • TYPE
  • USERDNSDOMAIN
  • USERDOMAIN
  • USERDOMAIN_ROAMINGPROFILE
  • USERNAME
  • USERPROFILE
  • USER_ALIASES
  • USER_BUILD
  • USER_MAJOR
  • USER_MINOR
  • USER_PATCH
  • VBOX_MSI_INSTALL_PATH
  • VENDORED_BUILD
  • VENDORED_MAJOR
  • VENDORED_MINOR
  • VENDORED_PATCH
  • VERBOSE_OUTPUT
  • VS140COMNTOOLS
  • WINDIR
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_PYTHON: C:\Users\wt255008\.pyenv\pyenv-win\shims\python

Debug–specific environment variables:

  • PATH: C:\Users\wt255008\.pyenv\pyenv-win\versions\3.7.7;C:\apps\cmder\bin;C:\apps\cmder\vendor\bin;C:\apps\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\apps\cmder\vendor\conemu-maximus5;C:\apps\cmder\vendor\conemu-maximus5\ConEmu;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 (x86)\Webex\Webex\Applications;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Users\wt255008\.pyenv\pyenv-win\bin;C:\Users\wt255008\.pyenv\pyenv-win\shims;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Users\wt255008\AppData\Local\Microsoft\WindowsApps;C:\Users\wt255008\AppData\Roaming\npm;C:\Users\wt255008\AppData\Local\bin\NASM;C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64;C:\Applications\Atlassian\atlassian-plugin-sdk-8.0.16\bin;C:\Program Files\CMake\bin;C:\Users\wt255008\.dotnet\tools;C:\Users\wt255008\AppData\Local\Yarn\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\apps\cmder;C:\apps\cmder\vendor\git-for-windows\cmd;C:\apps\cmder\vendor\git-for-windows\mingw64\bin;C:\apps\cmder\vendor\git-for-windows\usr\bin
  • LANG: en_US.UTF-8

@uranusjr
Copy link
Member

pyenv-win’s Batch file hack does not work well because a Batch file is ultimately not an executable. I would consider this a pyenv-win deficiency, not pipenv.

@uranusjr
Copy link
Member

Maybe we should reject a pyenv-win shim directly when it is found, instead of failing later when trying to create a virtual environment from it.

@wadetracy
Copy link
Author

does that mean I'm out of luck using pipenv on Windows or is there a better way?

@uranusjr
Copy link
Member

uranusjr commented Oct 29, 2020

You can specify a full path to the real Python executable, like pipenv --python=C:\Python35\python.exe. This should always work (assuming that path is valid). pipenv --python=py should also work if you have py.exe installed. You can also specify by version like pipenv --python=3.8, which would call into py.exe automatically IIRC.

@wadetracy
Copy link
Author

None of those options worked - pipenv still used the PIPENV_PYTHON env variable to try and name the virtual environment which caused an OS error. I uninstall everything and reinstalled and made sure there was no PIPENV_PYTHON env variable and now it seems to be working.

@ben-gardner262
Copy link

ben-gardner262 commented Sep 12, 2021

Had the same issue as the originally reporter. I tried @uranusjr suggestion, but I had to specify the batch file. Example: pipenv --python="%USERPROFILE%\.pyenv\pyenv-win\shims\python3.8.bat" Then it worked for me.

@lukaszgradzik
Copy link

lukaszgradzik commented Nov 2, 2021

I had to set PIPENV_PYTHON variable with full path to exe file, any other solution was not working for me.
Also using variables like %USERPROFILE% in this path was failing, even if it was pointing to exaclty the same python.exe... I have no idea what is going on...

set PIPENV_PYTHON=C:\Users\username\.pyenv\pyenv-win\versions\3.8.0\python.exe

@Amondale
Copy link

@lukaszgradzik this worked for me also. I encountered a different issue in my .vscode/settings.json file, which pointed at <project_name>-<8digitGUID>/python.exe. Maybe this is just how pipenv works with pyenv-win? A bit annoying, as I have the project in gitlab, I guess I need to .gitignore the local .vscode folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants