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

Make Poetry executable use python3 from path if >= 3.5 #1922

Closed

Conversation

frankier
Copy link

Currently SetupReader only works with Python versions >=3.5 -- but on some versions of Ubuntu and Debian, Poetry may run under Python 2, even when Python 3 is available.

On some distributions /usr/bin/python is still Python 2 by default and /usr/bin/python3 is Python 3. pyenv follows a similar convention, shimming both the python and python3 executables.

This patch changes the poetry executable to first use the python executable, if it is >= 3.5, then use the python3 executable, if it is >= 3.5, and otherwise fall back to whichever version is available under python.

@sdispater
Copy link
Member

I think this is a duplicate of #1878 or at least close in spirit, so I am closing this to centralize discussions and reviews.

@jonapich
Copy link
Contributor

jonapich commented Jan 23, 2020

@frankier can you expand a bit on your issue? Technically, poetry can prepare e.g.: 3.8 environments from a 2.7 runtime, so I'm not sure why SetupReader would suffer from poetry's interpreter version 😕

@frankier
Copy link
Author

frankier commented Jan 23, 2020

The code running SetupReader is run within the main Poetry process, not within the context of the environment. Whichever Python version ends up running $HOME/.poetry/bin/poetry is used. On some systems this will be Python 2.7.

@jonapich
Copy link
Contributor

Thanks for the additional info!

The general case of favoring python3 over python2 will fix it for you, but I think your claim points to a project-specific problem.

I think you should be able to write this in your pyproject.toml file (maybe it works, I dunno):

[build-system]
requires = ["poetry>=0.12", "python>=3.5"]

Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants