-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
creating venv with specific --python version (not in PATH variable) fails after 2023.4.29 #5893
Comments
@mjhalwa Unfortunately I don't see the system PATH in the support info, so I only have to go by that you added it to the path -- it should find it, I haven't personally run into this issue. |
Sorry for the delay. I was able to investigate some more. My
Note: all are installed in separated paths next to From comparing to another machine where Now when adding
So I see the pattern, that for
And indeed Do I need to carry all installed Python Versions in the |
I tried on a fresh windows 10 now to
Thus it seems to me that pipenv does only recognize Python Versions where the binary can be found in the PATH. Additonally I installed a Python 3.10.10 with leaving the Python installer at is defaults and "Install Now" (leaving "add python to PATH" unchecked) and without "Disable path length limit"
Thus, I guess, I can confirm, If I now add Some additional checks:
Now, uninstalling the latest pipenv and force install @matteius I hope you can now reproduce my issue For me current releases do not meet the expected behavior, as having old python versions in my PATH makes no sense and even the latest python version is not required in my PATH as Py-Launcher detects all python versions successfully. I would expect |
I am seeing the same behavior on Windows with Pyenv. I used to be able to Note that I see the same behavior where older versions of pipenv used to find and use the correct Python version, but newer pipenv releases aren't doing this on Windows. I'm also seeing a related Stack Overflow question: https://stackoverflow.com/questions/76478886/version-2023-5-19-or-later-pipenv-fails-to-recognize-various-pythons-installed |
just tried latest |
I was thinking of a way to contribute with a PR to fix this. While investigating where this problem arises in pipenv, I figured out that the problem actually goes down to the dependency pythonfinder that was updated to version 2.0.0 in Release 2023.5.19. So I tried installing pythonfinder globally to run from pythonfinder import Finder
f = Finder()
f.find_python_version(3, minor=11)
f = Finder(global_search=True)
f.find_python_version(3, minor=11)
f = Finder(system=True)
f.find_python_version(3, minor=11)
f = Finder(global_search=True, system=True)
f.find_python_version(3, minor=11) , but all of these only returned my installation of Python if it was part of the Windows PATH. So the PATH seems to work, but the PEP-514 part seems actually to be broken, what is discussed in pythonfinder Issue 158. @matteius This way I learned about your PR to pipenv #6140 that would actually fix this issue (if I understand correctly). Thank you for working on it, please let me know if I could support somehow (e.g. testing a possible fix on my machine) [EDIT] In case this helps, I checked the possible registry keys according to PEP-514 that could store the Python installation and found my 3 installations of python only under
I do not have an entry |
@mjhalwa if you could take a look again at the pipenv pythonfinder PR -- I updated it tonight. I am not sure if it works 100% but I do want to get this issue patched, even if its not 100% perfect, if its a functional improvement is what I am going for this iteration before shipping pipenv 3000 .... willing to make it 100% perfect though if we get enough eyes on it and suggestions to get it there. |
Currently I just have
I have following python installation pats in
Note: that on this machine So I cloned the branch of your PR #6140 on Commit a26d677 . I ran
Note: this creates a Python 3.12 venv. and then navigated in the shell environment to some empty directory and tried (in between always running Note: same results with Powershell v5.1, cmd.exe and Git Bash
In comparison with the latest official Version 2023.12.1 (installed globally via
and also tested
Compared to my original Issue:
I keep this machine just in case you have any more improvements to test. @matteius How do you feel about adding a flag to list all python installations that pipenv can find like py-Launcher has on Hope this helps a little. |
@matteius I was wondering if chaging all occurrences of I changed following strings
I also noticed the reason why Version 3.12 works above is due to the python interpreter in the venv (confirmed with
to the Pipfile of 6abb08c , made |
Issue description
what fails:
If I try to setup a venv using
pipenv install --python 3.11
orpipenv install
on a directory that contains aPipfile
with[requires] Python = "3.11"
e.g.pipenv fails with the following error:
(same happens for other Python Versions like 3.10)
what works
If instead running
pipenv install
on a plain directory orpipenv install
on a directory with following Pipfile (without[requires]
)it creates a venv with my latest installed Python version
3.11.4
Expected result
create a venv with python from my installation of Python 3.11 at
C:\Software\Python\Python3_11_4
Actual result
pipenv install --python 3.11 --verbose
returnsSteps to replicate
I am running on Windows 10 64bit.
install Python 3.11.4 in
C:\Software\Python\Python3_11_4
add
C:\Software\Python\Python3_11_4\Scripts
to SystemPATH
open powershell (v7) and run
py -3.11 -m pip install pipenv
(which installs latest pipenv2023.8.28
)go to empty directory and run
pipenv install --python 3.11
-> ERRORbut go to empty directory and run
pipenv install
works and creates following Pipfile (without[requires]
):also go to empty directory and run
pipenv install --python C:\Software\Python\Python3_11_4
worksuninstall pipenv
py -3.11 -m pip uninstall pipenv
install older pipenv<=2023.4.29
py -3.11 -m pip install pipenv==2023.4.29
go to empty directory and run
pipenv install --python 3.11
-> works and creates following Pipfile (with[requires]
)all newer versions than
2023.4.29
fail installing a venv with specific python version and, all up to2023.4.29
seem to work (I tested2022.6.7
,2022.11.11
,2023.2.4
and2023.4.29
). Testing with2023.5.19
,2023.6.2
,2023.7.1
and latest2023.8.28
all failed.Please run
$ pipenv --support
, and paste the results here. Don't put backticks (`
) around it! The output already contains Markdown formatting.$ pipenv --support
Pipenv version:
'2023.8.28'
Pipenv location:
'C:\\Software\\Python\\Python3_11_4\\Lib\\site-packages\\pipenv'
Python location:
'C:\\Software\\Python\\Python3_11_4\\python.exe'
OS Name:
'nt'
User pip version:
'23.2.1'
user Python installations found:
PEP 508 Information:
...
I omitted PATH and environment variables and hope they are currently not relevant.
The text was updated successfully, but these errors were encountered: