Contraditory warning from `poetry shell` on Poetry 1.2.2
See original GitHub issue- 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 (
-vvvoption) 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)
Issue Analytics
- State:
- Created a year ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Announcing Poetry 1.2.2 | Blog
The Poetry team is pleased to announce the immediate availability of Poetry 1.2.2. This release contains several fixes for regressions and ...
Read more >Announcing Poetry 1.2.0 -- Python dependency management ...
My read is that groups are meant not to be exposed as extras — groups are for internal use and wouldn't make sense...
Read more >All my poetry commands fail with 'The Poetry config is invalid'
I'm trying to install all dependancies for my project from pyproject.toml with 'poetry install' ,and I keep getting the message. The Poetry ......
Read more >A Poetic Apology. Or Why Should You Use Poetry to Manage…
You might have also learned that if you happen to be working at the same time on multiple projects with conflicting dependencies then...
Read more >python-poetry/poetry 1.2.0rc1 on GitHub - NewReleases.io
Changed · Poetry now falls back to gather metadata for dependencies via pep517 if parsing pyproject. · Replaced Poetry's helper method canonicalize_name() with ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

At a glance, this looks like it might be the same behaviour as #7158
@staticdev a potential workaround for your initial issue is to run poetry env use before any venv with the -py3.10 suffix exists.
poetry env use ~/.pyenv/versions/3.10.6/bin/pythonorpoetry env use 3.10<-- creates the venv with 3.10 python.