Skip to content

Wrong python version in new installation #3463

@ricardo-reis-1970

Description

@ricardo-reis-1970
  • 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:
  • Poetry version:
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

I have two version of Python:

  • 3.9.0
  • 3.6.6

I'm currently developing a project that is somewhat locked to 3.6.6, but also running experiments on latest Python, so I need both. I installed 3.6.6 first, so when I run where python, I get

C:\Program Files\Python39\python.exe
C:\Program Files\Python36\python.exe

This means that simply running python will run 3.9.0, as it is ahead in the PATH.

Having said all this, 3.6.6 is still available and here's the very top of my pyproject.toml:

[tool.poetry.dependencies]
python = "^3.6.6"

With this, I was expecting to have poetry to create the virtual environment correctly, but it does not. It simply goes to the first python.exe it can find — 3.9.0 — and then nothing will run.

Workarounds:

  • uninstall Python 3.9.0 whenever I need to recreate the .venv: highly inconvenient;
  • create the virtual environment by hand: I am using poetry to do that.

How can I enforce the Python version? Am I doing something wrong?

This is not a current duplicate, but I came across complaints online from 2 years ago along the same lines, and these were supposed to have been fixed long ago.

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