python-poetry / python-poetry/poetry-plugin-shell

Contraditory warning from `poetry shell` on Poetry 1.2.2

Open
#11 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
141
Forks
10
Avg merge
59m
Merged PRs (30d)
3

Description

  • Poetry version: 1.2.2
  • Python version: 3.10.6
  • OS version and name: Debian 11
  • pyproject.toml:

Relevant part:

[tool.poetry.dependencies]
python = ">=3.10.0,<4.0"
click = ">=8.1.1"
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I have many versions of Python installed with Pyenv, but my settings are:

pyenv local 3.10.6
pyenv global 3.10.6

I have created a virtualenv with poetry install and when I do poetry shell I get:

The currently activated Python version 3.9.2 is not supported by the project (>=3.10.0,<4.0).
Trying to find and use a compatible version. 
Using python3 (3.10.6)
Spawning shell within /home/user/.cache/pypoetry/virtualenvs/project-0KWPzb1N-py3.10

I don't understand this warning since my venv was created with py3.10, my pyenv only has 3.10 and it says python3 (3.10.6).

Then after poetry shell I get error with:

poetry run project
Current Python version (3.9.2) is not allowed by the project (>=3.10.0,<4.0).
Please change python executable via the "env use" command.

Successful env use 3.10.6 and again same error:

env use 3.10.6
Using virtualenv: /home/user/.cache/pypoetry/virtualenvs/project-0KWPzb1N-py3.10
poetry run project
Current Python version (3.9.2) is not allowed by the project (>=3.10.0,<4.0).
Please change python executable via the "env use" command.

I also tried deleting the folder /home/user/.cache/pypoetry/virtualenvs/project-0KWPzb1N-py3.10 and creating again the environment but I get the same warning and errors:

poetry install
The currently activated Python version 3.9.2 is not supported by the project (>=3.10.0,<4.0).
Trying to find and use a compatible version. 
Using python3 (3.10.6)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported sequence with poetry install, poetry shell, poetry run project, and env use 3.10.6, using the listed Poetry, Python, and Debian versions. Trace how the active interpreter is detected and how the environment is selected; done means the commands consistently use Python 3.10.6 without the contradictory warning or version error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.