pyenv / pyenv-virtualenv

a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
MIT License
6.18k stars 399 forks source link

Automatic virtualenv activation buggy with .python-version #437

Closed patata3000 closed 1 year ago

patata3000 commented 1 year ago

Too many issues will kill our team's development velocity, drastically. Make sure you have checked all steps below.

Prerequisite

Description

Hey! So I'm trying to setup pyenv with pyenv-virtualenv. I have a virtualenv called foo and a directory called foo_project containing a .python-version with foo written inside. I think that I have setup pyenv and pyenv-virtualenv correctly.

In my .zshrc (and my .zprofile as well), I have:

export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1

When I cd into foo_project, it should activate foo => It does not happen. If I run pyenv activate foo => foo gets activated. If after that, I run pyenv deactivate => foo gets deactivated normally. If after deactivating, I am (or I cd later on) in foo_directory => foo is (or gets) activated.

After that, pyenv-virtualenv works normally. If I cd into another directory with any valid .python-version, virtualenv get activated.

Tell me if you need anymore info. Debug logs were hard to get. There were many, many lines...

patata3000 commented 1 year ago

Hey! It's working now somehow. Not sure why... Closing