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.

poetry env remove with virtualenvs.in-project = true

See original GitHub issue
  • 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: 18.04.3 LTS (Bionic Beaver)

  • Poetry version: Poetry version 1.0.5

  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/fgervais/5a33d9df4cca064f02ce7fa6136c7e5e

Issue

I think poetry env remove fails when virtualenvs.in-project = true

$ poetry env info

Virtualenv
Python:         3.6.9
Implementation: CPython
Path:           /home/fgervais/personal/test/.venv
Valid:          True

System
Platform: linux
OS:       posix
Python:   /usr

$ poetry config --list
cache-dir = "/home/fgervais/.cache/pypoetry"
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/fgervais/.cache/pypoetry/virtualenvs
$ poetry env remove 3.6.9

[ValueError]
Environment "test-dT4kcP9T-py3.6" does not exist.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:26
  • Comments:8

github_iconTop GitHub Comments

11reactions
deepaerialcommented, Dec 28, 2021

Is this issue is still active? I found the same problem on macOS 11.6 Big Sur with Python 3.9 and poetry version 1.1.12:

$  poetry env remove .venv                                                                                     
/bin/sh: .venv: command not found

  EnvCommandError

  Command .venv -c "import sys; print('.'.join([str(s) for s in sys.version_info[:3]]))" errored with the following return code 127, and output: 
  

  at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py:625 in remove
       621│                     shell=True,
       622│                 )
       623│             )
       624│         except CalledProcessError as e:
    →  625│             raise EnvCommandError(e)
       626│ 
       627│         python_version = Version.parse(python_version.strip())
       628│         minor = "{}.{}".format(python_version.major, python_version.minor)
       629│ 

4reactions
geozekecommented, Oct 18, 2022

Same issue (Ubuntu 22.04). Interestingly, if the only virtual environment you have is a local .venv in your project, this works fine:

poetry env remove --all
Read more comments on GitHub >

github_iconTop Results From Across the Web

I can't delete an poetry managed environment - Stack Overflow
The simplest way to delete poetry env is to try something like this. poetry env remove python3.10.
Read more >
Managing environments | Documentation - Poetry
If you use a tool like pyenv to manage different Python versions, you can set the experimental virtualenvs.prefer-active-python option to true .
Read more >
Python Virtual Environments tutorial using Virtualenv and Poetry
A mini-guided Python tutorial showing how to use virtual environment and why it's matters on virtualenv and poetry illustrated examples.
Read more >
Python poetry: Explanations and tips - Frank-Mich's Blog
Tip: Set virtualenvs.in-project to true ... Personally, I prefer to keep my virtual environment on hand. If I need to delete it for...
Read more >
Poetry Advance - Python Biella Group
The secret formula for each poetry-based project is the establishment of a ... poetry and venv exit # remove venv with Poetry poetry...
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