python binary not found on PATH
Closed this issue · 7 comments
Issue Details
When starting my zsh in iTerm I get the following error message:
WARNING: python binary not found on PATH.
zsh-autoswitch-virtualenv plugin will be disabled.
~❯
Even though Python is installed with pyenv:
~❯ python --version
Python 3.8.12
~❯ type python
python is /Users/kleinboelting/.pyenv/shims/python
When I start zsh in zsh the error messages vanishes and the zsh-autoswitch-virtualenv plugin is working.
~❯ zsh
~❯ cd /tmp/foo
Switching virtualenv: foo-ktrt [Python 3.8.12]
(foo-ktrt) /tmp/foo❯
Reloading omz solves the problem as well.
~❯ omz reload
~❯ cd /tmp/foo
Switching virtualenv: foo-ktrt [Python 3.8.12]
(foo-ktrt) /tmp/foo❯
Please provide the following details when opening an issue:
Operating System (uname -a)
Darwin TinaBrix.local 21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000 arm64
zsh version (zsh --version)
zsh 5.8 (x86_64-apple-darwin21.0)
autoswitch-virtualenv version
echo "$AUTOSWITCH_VERSION"
3.6.0
How is zsh-autoswitch-virtualenv installed?
- oh-my-zsh
Steps to reproduce the issue
Start up zsh in iTerm
gist link to your zshrc
https://gist.github.com/seakayone/7704c5de3d5f2635297778b2b3d20b68
I think the reason is that this plugin loads before your setup pyenv in your zshrc.
So at the point in time it checks if python exists - it fails.
This obviously isnt great so I'll come up with a fix :)
@seakayone in the meanwhile, you can run: enable_autoswitch_virtualenv
to force enable it.
specifically, you can add it to the end of your zshrc to make sure it loads up
Thank you very much for the quick reply. enable_autoswitch_virtualenv
is really helpful as a workaround - much quicker than reloading the entire omz.
I also tried setting AUTOSWITCH_DEFAULT_PYTHON
but this is only affecting new virtual environments. Maybe this could be checked as fallback when the plugin tries to detect the python interpreter?
I think the correct solution is to fix this plugin to correctly work with plugins which are loaded after it :) if you can tesdt #176 we should be be to check if it fixes this issue.
Agreed, that is even better. Thanks for the fix, it works for me.
Hi @hans-d :) yes, seems like I just forgot about that one but I will work on merging it some time soon