-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Detect and select a compatible installed Python interpreter #9593
Comments
#6940 looks like the open duplicate, please close as the years go by I would think that reasons to worry about python2 become fewer and fewer, but I expect if you submit a pull request then it has every chance |
Thanks for pointing out the duplicate issue. Yes, the reasons to worry about Python 2 projects become fewer and fewer over time. In other words, using poetry remains a compatibility risk indefinitely. This is especially worrying because if you still use a Python 2 project today, you most certainly absolutely have to use it for some business reason. This means that in this scenario, the only workable way is most likely to port away from poetry instead of porting the Python 2 project to Python 3. Because this defeats the purpose of using poetry in the first place, the reasonable recommendation is to not use poetry unless you are absolutely sure to never need to run it on a system with Python 2 projects. There is poetry/src/poetry/utils/env.py Line 1231 in f1af3f8
|
I again invite you to make a pull request. People who care about python2 are going to be an ever-dwindling minority, your chances of someone else showing up and doing something about this for you are only going to decrease. Anyway: please close this issue, discussion should happen in the already open one. Dividing that into several places will not help future readers! |
Thanks for being open for a potential pull request. I might just create one if I find a way to fix this. Thanks for being clear about poetry dismissing users who (have to) care about Python 2. This is valuable information for my future recommendations. I agree that we should keep discussions focussed. Closing in favor of #6940. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Kind
Change in current behaviour
Description
My ambition for the README of my poetry project is to be executable from top to bottom on a new system (without errors or warnings). I see that other projects spare the installation steps that concern the operating system. My strong-man argument for their ambition is that users should be able to configure their system suitably themselves. poetry is one such example, but I am not capable of configuring all three major operating systems in a way that is workable for each and every software project I might set up. Neither are the users of poetry, as it turns out. As a result, the issue that the default Python installation could not be found comes up repeatedly, at least:
2022: #4416
2022: #4542
2022: #6841
2023: #7456
Impact
I would argue that in an effort to cater to one's users, each project should specify a best-practice configuration on the operating system level. I suppose to draw the line for a handover of responsibility when the user accepts or deviates from the instructions in executing them to configure their system. Since our project is employing poetry and it is not handling this complexity for us and our users, we need to handle it on the level of our project. For this purpose, I would suggest adding these instructions to the README, but alternatives include creating an installer script, as is common for projects with system-level dependencies.
In this case, configuring the operating system correctly is wholly impossible. Because poetry expects
python
to be a Python 3 and older Python projects might expectpython
to be Python 2.7, one cannot configure it to run poetry and many older Python projects. This hints at the root cause of this issue is not at all a (mis-)configuration, but mismatched expectations. While it might seem naive that older Python projects expected Python to always stay on version 2, poetry should really strive to be better than that and at least notice its (equally naive) expectation of Python to always have been on version 3.As a solution, poetry should detect installed Python versions and choose a suitable one to run on. For poetry is currently tested against Python 3.8, 3.9, 3.10, 3.11, and 3.12. This seems to give sufficient guidance in selecting a compatible Python interpreter to run poetry on.
Workarounds
Each time before working on a poetry project:
Each time before working on a Python 2 project:
The text was updated successfully, but these errors were encountered: