Skip to content

Poetry links to python3 and not python3.x #3134

@ericriff

Description

@ericriff
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Ubuntu 16

  • Poetry version: 1.1.1

Issue

I have multiple versions of python3 on my system and I use update-alternatives to choose where python3 points to.

I specify the desired python version for each project in the pyproject file as follows:

[tool.poetry.dependencies]
python = "==3.5.2"

So in this case I enforce version 3.5.2. The problem is that poetry creates a symlink to python3 and not python3.5, which works fine until I change the default python version:

$ tree .venv/bin
.venv/bin
├── activate
├── activate.csh
├── activate.fish
.
.
├── python -> /usr/bin/python3
├── python3 -> python
├── python3.5 -> python
.
.

If I specifically tell poetry to use python3.5, it creates the correct symlink:
EDIT: This is only true if the default version of python is not the one specified in the pyprojet. That means that, in this case, if the default version of python3 is 3.5, the following commands produce the same output as the previous ones.

$ poetry env use python3.5
$ poetry install
$ tree .venv/bin
.venv/bin
├── activate
├── activate.csh
├── activate.fish
.
.
├── python -> /usr/bin/python3.5
├── python3 -> python
├── python3.5 -> python
.
.

This is a huge problem for me since the python version should be enforced very strictly. I have taken a look at how pipenv handles this and it creates the symlink to the specific python version and not just plain python3.

I also don't see any reference to the python version in the lockfile. Is this normal?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions