pipenv
pipenv copied to clipboard
Pythonfinder should support the windows `py` command
Since upgrading pipenv to v2023.5.19, it does not successfully recognize the version of Python installed on my PC. It fails as follows.
PS > py -m pipenv --python 3.9
Warning: Python 3.9 was not found on your system...
Neither 'pyenv' nor 'asdf' could be found to install Python.
You can specify specific versions of Python with:
$ pipenv --python path\to\python
The path to each version of Python installed on the PC can be found from the py command.
(I have not added the Python PATH according to the default installer settings.)
PS > py --list-paths
-V:3.11 * [USERPROFILE]\AppData\Local\Programs\Python\Python311\python.exe
-V:3.10 [USERPROFILE]\AppData\Local\Programs\Python\Python310\python.exe
-V:3.9 [USERPROFILE]\AppData\Local\Programs\Python\Python39\python.exe
-V:3.8 [USERPROFILE]\AppData\Local\Programs\Python\Python38\python.exe
-V:3.7 [USERPROFILE]\AppData\Local\Programs\Python\Python37\python.exe
Therefore, as indicated in the error message, the virtual environment can be successfully created by specifying the Python path to be used.
> py -m pipenv --python [USERPROFILE]\AppData\Local\Programs\Python\Python39\python.exe
-> It's OK.
However, by simply downgrading pipenv to v2023.4.29, the above command succeeds as before.
PS > py -m pip install -U pipenv==2023.4.29
...
Successfully installed pipenv-2023.4.29
PS > py -m pipenv --python 3.9
Creating a virtualenv for this project...
...
Successfully created virtual environment!
Virtualenv location: [VENV PATH]
Creating a Pipfile for this project...
The same problem occurred on three PCs (Windows 10 and 11).
Are there any steps that should be changed to enable the creation of virtual environments with py -m pipenv --python commands without specifying the full path of Python?
$ pipenv --support
Pipenv version: '2023.7.3'
Pipenv location: '[USERPROFILE]\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pipenv'
Python location: '[USERPROFILE]\\AppData\\Local\\Programs\\Python\\Python311\\python.exe'
OS Name: 'nt'
User pip version: '23.1.2'
user Python installations found:
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.11.3',
'os_name': 'nt',
'platform_machine': 'AMD64',
'platform_python_implementation': 'CPython',
'platform_release': '10',
'platform_system': 'Windows',
'platform_version': '10.0.19045',
'python_full_version': '3.11.3',
'python_version': '3.11',
'sys_platform': 'win32'}
System environment variables:
ALLUSERSPROFILEAPPDATACOMMONPROGRAMFILESCOMMONPROGRAMFILES(X86)COMMONPROGRAMW6432COMPUTERNAMECOMSPECCUDA_PATHCUDA_PATH_V11_8DRIVERDATAHOMEDRIVEHOMEPATHLIBLOCALAPPDATALOGONSERVERMEFTLOGROOTMMM_COM_SLACK_API_TOKENNUMBER_OF_PROCESSORSNVTOOLSEXT_PATHONEDRIVEOSPATHPATHEXTPIPENV_VENV_IN_PROJECTPROCESSOR_ARCHITECTUREPROCESSOR_IDENTIFIERPROCESSOR_LEVELPROCESSOR_REVISIONPROGRAMDATAPROGRAMFILESPROGRAMFILES(X86)PROGRAMW6432PSMODULEPATHPUBLICSYSTEMDRIVESYSTEMROOTTEMPTMPUSERDNSDOMAINUSERDOMAINUSERDOMAIN_ROAMINGPROFILEUSERNAMEUSERPROFILEWINDIRWSLENVWT_PROFILE_IDWT_SESSIONZES_ENABLE_SYSMANPYTHONDONTWRITEBYTECODEPIP_DISABLE_PIP_VERSION_CHECKPYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_VENV_IN_PROJECT:true
Debug–specific environment variables:
PATH:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\libnvvp;C:\oracle\11gr2\prones\bin;C:\Program Files (x86)\NetCOBOL\;C:\Program Files (x86)\Common Files\Fujitsu\MeFt\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.3.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;[USERPROFILE]\.cargo\bin;[USERPROFILE]\AppData\Local\Microsoft\WindowsApps;[USERPROFILE]\AppData\Local\Programs\Microsoft VS Code\bin;[USERPROFILE]\.dotnet\tools;[USERPROFILE]\AppData\Roaming\npm;[USERPROFILE]\.dotnet\tools
This is the first I've learned of the py command, and unfortunately it was not in our documentation that this was ever supported. I welcome to pythonfinder PRs that could support this, but what probably happened is in the refactor to pythonfinder -> pydantic, I encountered that we were using a completely different library to find Windows pythons which was creating problems with trying to have consistent code paths that we maintain and can fix windows bugs in. So now all operating systems use the same pythonfinder code paths that we maintain so it should be possible to support this again in the future.
@matteius Thank you for commenting on my problem. It would be great if the py command was supported again.
I've labeled it as something that will be considered for PR improvements, but myself and the other maintainer have limited bandwidth at present to make all of these improvements ourselves.
I believe I added sufficient support in: https://github.com/pypa/pipenv/pull/6360 however it could use testing specifically of the py command.