-
-
Notifications
You must be signed in to change notification settings - Fork 429
Description
I want to install and manage Python instances with brew. Unfortunately, this plugin seems incompatible with a feature called pyenv-sync, that automatically links the brew installations with pyenv versions. Whenever I try to use a version different than system, e.g. pyenv --debug virtualenv 3.10 venv, the command exits with error code 127 and echo pyenv: pip: command not found.
I found that fixing this issue with this commit introduces issue. It is because pyenv-virtualenv script assumes that versions different than system are virtualenvs and uses python as the python binary. In result the script does not resolve pip properly and the whole creation of venv fails.
$ brew -v
Homebrew 4.4.22-57-g19332ee
Homebrew/homebrew-core (git revision 3a740ab22a6; last commit 2025-02-26)
Homebrew/homebrew-cask (git revision d01fa801c8f; last commit 2025-02-26)
$ brew list --versions | egrep 'python|env'
pyenv 2.5.3
pyenv-virtualenv 1.2.4
python-packaging 24.2
python@3.12 3.12.9
python@3.13 3.13.2
virtualenv 20.29.2
$ pyenv -v
pyenv 2.5.3
$ pyenv virtualenv --version
pyenv-virtualenv 1.2.4 (virtualenv virtualenv 20.29.2 from /opt/homebrew/Cellar/virtualenv/20.29.2/libexec/lib/python3.13/site-packages/virtualenv/__init__.py)
pyenv virtualenv --version points at virtualenv that is installed system-wide and uses python@3.13 as a dependency
I quickly analysed the script and IMO the easiest way to fix that is to add python3 as a fallback in detect_venv() when PYENV_VERSION is not equal to "system"