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.

Running deactivate inside a poetry shell breaks it

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.

  • OS version and name: macOS Catalina

  • Poetry version: 1.0.5

Issue

After running poetry shell I tried to exit running deactivate. That deactivated the virtualenv, that is, I was not able to access anymore the version of de libs installed for my project. But when I tried to run poetry shell again, I got this message:

Virtual environment already activated...

Then I discovered I should exit using the exit command.

I think the deactivate command should be disabled inside the poetry shell.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
finswimmercommented, May 13, 2020

Hello,

the reason for this behavior is, that poetry shell does two things:

  1. start a new shell
  2. activate the virtual environment

The command deactivate is provided by the venv and exit is provided by the shell itself. poetry has no influence on that commands.

So to leave the env and the shell using exit is the intended way.

fin swimmer

1reaction
cwkang1998commented, Nov 16, 2021

I think this should be included in the documentation on the shell command here: https://python-poetry.org/docs/cli/#shell. May I add a pull request to indicate the use of exit instead of deactivate ?

Are you going to do this? I have time to do this as well.

Yup. Sorry, I didn’t get an email for this until now so I didn’t know I got a go. I’ll add it by today and submit the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic usage | Documentation | Poetry - Python dependency ...
There are several ways to run commands within this virtual environment. ... To deactivate the virtual environment and exit this new shell type...
Read more >
The virtual environment found seems to be broken | python ...
In my case, I am using python 3.7 sudo apt-get install python3.7-venv. Other way is to disable virtual environment poetry config ...
Read more >
Working on a project - Copier Poetry - pawamoy's website
Use poetry run CMD [ARGS...] to run a command in the virtualenv. Use poetry shell to activate/enter the virtualenv, and exit to deactivate/exit...
Read more >
Pipenv: promises a lot, delivers very little | Chris Warrick
I create ~/git/website and run pipenv install Django in that ... exit or ^D. If you type deactivate , you are working with...
Read more >
Dependency Management With Python Poetry
Pin Dependencies in poetry.lock; Install Dependencies From poetry. ... You can run poetry --version in your terminal to see if poetry works.
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