-
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
Choose the host Python version used when running poetry installed with 'get-poetry.py' #3288
Comments
Aslo on this subject, on OSs like ubuntu which have a
I believe that poetry should default to |
Personal opinions:
|
Hello,
I've talked about this in another issue (#3184 (comment)). The rational behind this, is perfect interaction with pyenv. Change the current python version with it and poetry will create the venv with this version immediately. That's the same reason why the shebang than uses
I guess what you have in mind is PEP 394. This PEP has evolved about the time. Initially it was the recommendation that Two things I recommend instead of changing the shebang by hand:
fin swimmer |
I see. It could be mentioned in the "installation" section, and in the Python EOL warning message, or the FAQ. Do people really use pyenv though?
That might be it, yes. Thanks! For the rest, I would like to remind that it is not just a matter of Python 2 vs. Python 3. If I remove Aliases might be good enough and simple enough for most of the use cases. For example in PATH_TO_POETRY=$(which poetry)
alias poetry-py2.7="python2.7 ${PATH_TO_POETRY}"
alias poetry-py3.8="python3.8 ${PATH_TO_POETRY}"
alias poetry="python3.9 ${PATH_TO_POETRY}" Maybe I should accelerate the work on making poetry work out of a zipapp, maybe that could help a bit. |
Thanks for the clarification. However, not everyone uses pyenv and many people run Ubuntu. So how about at least having the option of forcing which python to write to the shebang line by means of an environment variable? Then we could do:
|
@brechtm If I may. Real question, I truly do not know: |
Because For my use case, however, installation is automated, so it should not require root privileges. For now, I'm using a locally patched version of get-poetry.py that prefers [1] Perhaps the docs should mention pyenv if this indeed the reason for preferring python to python3? Also, a search function on https://python-poetry.org/docs/ would be great. (sorry, off-topic, I know) |
When you feel comfortable enough with Python, I think it is worth considering the alternative installation techniques, especially if the default technique causes you issues. I have not used it but pipx looks nice enough, that I would recommend at least trying it. A personal take on this.... # create a fresh virtual environment
pythonX.Y -m venv ~/.local/bin/.venvs/poetry-pyX.Y
# install poetry in that environment
~/.local/bin/.venvs/poetry-pyX.Y/bin/python -m pip install poetry
# add symlink in your binaries directory pointing to the newly installed poetry
ln -s ~/.local/bin/.venvs/poetry-pyX.Y/bin/poetry ~/.local/bin/poetry-pyX.Y
# use it
poetry-pyX.Y
# update it
~/.local/bin/.venvs/poetry-pyX.Y/bin/python -m pip install --upgrade poetry |
I had missed it, the pyenv workflow is (succinctly) documented here: |
A "simple" solution is to add a temporary directory to |
One of the primary reasons to use poetry over pip is because it manages the virtualenvs for you. I don't think requiring pyenv to install it and make it function is very useful. If I have to setup and use pyenv to use poetry, then I might as well just use pip inside the pyenv? |
Pyenv does not deal with Python virtual environments (the name is misleading). Pyenv deals with installing and "activating" multiple Python interpreters on the machine. So you can have Python 3.7, 3.8, 3.9 installed and easily switch from one to another as your current main Python, i.e. switch |
@sinoroc Yes, but the problem is when utilizing a system that has "python" defaulting to python2.7, it usually means certain system applications are dependent on it BEING python2.7. If we force users to activate a python3 environment and squashing the "python" environment to being python3, some core parts of their system are going to break. Unless we are suggesting a workflow of:
So that they don't accidentally move on to using other parts of the system that depend on If activating in environment to use poetry is necessary, then there isn't much difference from using pyenv and just doing:
|
I don't know. I don't feel like it is that big of a deal. I don't know why the shebang of poetry is not always |
@sinoroc Yeah, I'm more of discussing this because the ergonomics around it don't make sense to me and I would like to start recommending people use Poetry over things like pip and pipenv. So even though I know how to work around this flaw, I don't believe its safe to recommend use of the software when it'll be something MAJORITY of users hit. Most systems aren't defaulting to python3 for "python" and having to work around it is a weird limitation with many easy fixes. |
Hello,
I still don't get why people are trying to "work around" it. At the moment poetry works with python2 and python3. So there is no need to switch.
Because python2 and python3 are still supported. I think this will change with the next minor release (1.2), because then we drop python2 support. fin swimmer |
The As a downside the "pyenv workflow" no longer works. |
The install-poetry.py file is Python 3 only. Is there one for both Python 2 & 3? |
The |
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. |
Follow up to this issue:
Since #2683 a EOL warning message is displayed when poetry runs under a Python interpreter that has reached its end of life (EOL), for example Python 2.7, and 3.5. Fair enough. But when using a poetry installation initiated with
get-poetry.py
it does not seem possible to control which Python interpreter is being used. Which leads to the EOL warning message being legitimately displayed but there is no straightforward way for the user to switch to a different Python version. It is not reasonable to expect from the users that they uninstall the older Python interpreters.Related
The text was updated successfully, but these errors were encountered: