pyenv / pyenv-virtualenv

a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

command `pyenv deactivate` calls Failed to deactivate virtualenv.

IliyaZinoviev opened this issue · comments

I use Ubuntu 20.04.3 LTS.
Pyenv perfectly works except deactivate command.
~/.bashrc and ~/.profile files contain these lines:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"

Bash version is
> echo ${BASH_VERSION}

5.0.17(1)-release

in active virtualenv:

I do next calls in bash:

> pyenv virtualenv 3.9.5 test
> pyenv local test
> pyenv activate test

After that virtualenv is successfully loaded.
Then I called pyenv deactivate in the same shell but got the message:

Failed to deactivate virtualenv.

Perhaps pyenv-virtualenv has not been loaded into your shell properly.
Please restart current shell and try again.

I tried to deactivate it in different terminals and did it in project root directory.

What's my mistake? Please, help me!

Please see updated and hopefully clearer Pyenv shell setup instructions in https://github.com/pyenv/pyenv#readme
eval "$(pyenv virtualenv-init -)" should run in an rc file after eval "$(pyenv init -)" as before.

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.