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.

Unable to create poetry environment with python3.10

See original GitHub issue

Issue

I am unable to create a poetry environment with python3.10.

> poetry shell
The currently activated Python version 3.8.10 is not supported by the project (^3.10).
Trying to find and use a compatible version.
Using python3.10 (3.10.4)
Creating virtualenv poetry-issue-wxXJaBmj-py3.10 in /home/ethanbro/.cache/pypoetry/virtualenvs
Virtual environment already activated: /home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue-wxXJaBmj-py3.10
> which python
/usr/bin/python
> ls /home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue-wxXJaBmj-py3.10
lib  local  pyvenv.cfg 

As you can see, there is no bin/ directory under /home/ethanbro/.cache/pypoetry/virtualenvs/poetry-issue-wxXJaBmj-py3.10.

If I change my pyproject.toml to python3.9 and then run poetry env use $(which python3.9), everything works fine (the virtualenv has a bin directory).

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:8
  • Comments:8

github_iconTop GitHub Comments

3reactions
johnziebrocommented, Jun 10, 2022

Poetry Preview Release 1.2.0b1 addresses this issue:

Fixed an issue where the reported python version used for venv creation wasn’t correct (https://github.com/python-poetry/poetry/pull/5086).

Steps to get a working environment:

  • Uninstalled Poetry
  • Installed the preview release 1.2.0b1: curl -sSL https://install.python-poetry.org | python3 - --preview
  • If using pyenv, and not creating your virtualenv prior to running poetry, you must change the poetry config to prefer-active-python: poetry config virtualenvs.prefer-active-python true

Now poetry will respect the pyenv activated python and workflow returns to normal: poetry install cat .venv/pyvenv.cfg # expecting python 3.10.5

home = /home/anon/.pyenv/versions/3.10.5 implementation = CPython version_info = 3.10.5.final.0

See Docs: Managing environments for additional details.

2reactions
ethanabrookscommented, Jul 1, 2022

I tried uninstalling and reinstalling, but still encountering the same issue. I am not using pyenv, for the record.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure a virtual environment | PyCharm Documentation
Press Ctrl+Alt+S to open the IDE settings and select Project <project name> | Python Interpreter. · Expand the list of the available interpreters...
Read more >
Managing environments | Documentation - Poetry
By default, Poetry will try to use the Python version used during Poetry's installation to create the virtual environment for the current project....
Read more >
I am unable to create a new virtualenv in ubuntu?
I got the error while updating dependencies with poetry. Uninstalling virtualenv package that was present in the venv (probably as subdependency ...
Read more >
Dependency Management With Python Poetry
When your Python project relies on external packages, you need to make sure you're using the right version of each package.
Read more >
Installing and using virtualenv with Python 3
Although you can create a virtual environment using venv with Python3, it's recommended that you install and use virtualenv instead.
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