Skip to content

PyEnv + Poetry: Poetry does not use correct Python versions #5252

@S-UP

Description

@S-UP
  • 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: macOS 12.01

  • Poetry version: 1.1.13

Issue

I find it extremely challenging, i.e. impossible, to get poetry to use the correct Python version. I am using PyEnv to manage Python.

which python
/Users/XXX/.pyenv/shims/python
pyenv versions
  system
* 3.8.12 (set by /Users/XXX/projectA/.python-version)
  3.9.7
python -V
Python 3.8.12

BUT within projectA:

poetry shell

python -V
Python 3.10.2

Even though:

[tool.poetry]
name = "ABC"
version = "0.1.0"
description = ""
authors = ["XXX"]

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

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

I have zero clue what I am doing wrong. Reading a couple of online resources did not help my understanding much. However obvious this is for core users, it is extremely frustrating and counterintuitive for me.

How to set this up correctly?

See also:

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