Poetry: Running deactivate inside a poetry shell breaks it

Created on 5 May 2020  路  3Comments  路  Source: python-poetry/poetry

  • [ ] I am on the latest Poetry version.
  • [x] 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.

Question

Most helpful comment

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

All 3 comments

I totally agree with this and if it is allowed I think it would be better that don't depend on the environment variable

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

@finswimmer Oh, I see. I hadn't been accustomed to poetry shell but I understand it now. Thank you for your reply.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikaro picture nikaro  路  3Comments

jeremy886 picture jeremy886  路  3Comments

thmo picture thmo  路  3Comments

etijskens picture etijskens  路  3Comments

jhrmnn picture jhrmnn  路  3Comments