Why does poetry not use the specified Python version?


TL;DR: There is only one way to install poetry proper and that is with the installer script provided by the project itself.

I was sweating for the better part of an afternoon with a colleague about this. I had installed poetry, the new star in the python tooling world and it kept using the global version of Python instead the one for the project at hand, though poetry's own pyproject.toml specifies it. It was quite a frustrating experience.

At the end I found the reason for our frustration in the poetry docs. Quite a way into the page it states:

Using alternative installation methods will make Poetry always use the Python version for which it has been installed to create virtualenvs. So, you will need to install Poetry for each Python version you want to use and switch between them.

Alternative to what method you ask? Well, on reasonable operating systems this is the one:

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

The problem is, that almost everybody I work with does not start reading the project's documentation on how to install this particular tool. Instead everybody turns to their favorite package manager. So when a colleague of mine tried to setup the same project, he ran into the exact same issue. So if this is biting you too, I hope these lines helped you to avoid a major headache.


See also