question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 (-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)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ShadowLNCcommented, Dec 10, 2022

At a glance, this looks like it might be the same behaviour as #7158

1reaction
bikefrivolouslycommented, Nov 27, 2022

@staticdev a potential workaround for your initial issue is to run poetry env use before any venv with the -py3.10 suffix exists.

  • remove the venv if it already exists (usually a directory in ~/.cache/pypoetry/virtualenvs/).
  • from your project directory: poetry env use ~/.pyenv/versions/3.10.6/bin/python or poetry env use 3.10 <-- creates the venv with 3.10 python.
  • then run poetry install or poetry shell
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found