-
-
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
pipenv install --system fails when python
points to Python 2.
#5296
Comments
I haven't tried to see if this breaks anything else, but this simple change worked for me: diff --git a/pipenv/utils/shell.py b/pipenv/utils/shell.py
index 362290fa..f6e39bd0 100644
--- a/pipenv/utils/shell.py
+++ b/pipenv/utils/shell.py
@@ -445,7 +445,7 @@ def project_python(project, system=False):
if not system:
python = project._which("python")
else:
- interpreters = [system_which(p) for p in ("python", "python3")]
+ interpreters = [system_which(p) for p in ("python3", "python")]
interpreters = [i for i in interpreters if i] # filter out not found interpreters
python = interpreters[0] if interpreters else None
if not python: |
Thanks for your report @enku -- I was wondering also if putting |
@matteius I'll open a PR for this. |
Ok, in the process of trying to create a PR I'm having an issue running the tests. I'm following the
Sorry this is the first time working on this repo. Any help would be appreciated. |
@enku I believe remove step 5 and replace it with:
The test runner command can be found in the |
Just a heads up that there are currently two flaky tests that might fail for you, as they sometimes fail in the main test runner, those are: |
Ahh, cool. I knew I left something out. And thanks for the heads up about the flaky tests. |
Fix a regression from commit dbea3f5 where `pip install --system` tries to install using the `python` executable first which, on some systems may point to Python 2. Instead try `python3` first.
pipenv, version 2022.8.30 has been released. |
Fix a regression from commit dbea3f5 where `pip install --system` tries to install using the `python` executable first which, on some systems may point to Python 2. Instead try `python3` first.
Issue description
Since 2022.8.15
pipenv install --system
will fail on systems that have both Python 2 and Python 3 installed butwhich python
resolves to Python 2. In commit dbea3f5 it switched from usingproject._which()
which usessys.executable
to determine which python to run to usingpython_project()
which, when using--system
first checks forpython
and thenpython3
. So if, e.g. your project/system is using Python 3 which is installed as/usr/local/bin/python3
but your system Python package us Python 2 which is at/usr/bin/python
then it will try to execute using Python 2, resulting inExpected result
Expected result is
pipenv install --system
installs the dependencies using Python 3. Although I'm not sure it's really a bug since technically it is using the "system" Python. Nevertheless it is a regression.Actual result
Steps to replicate
/usr/local
but ensure there is no/usr/local/bin/python
pipenv install --system
Please run
$ pipenv --support
, and paste the results here. Don't put backticks (`
) around it! The output already contains Markdown formatting.I can not paste the actual output but please let me know if you still need it and I will try to come up with a trivial reproducer.
The text was updated successfully, but these errors were encountered: