pyenv / pyenv-virtualenv

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

No python after virtualenv activation #406

Closed subdavis closed 3 years ago

subdavis commented 3 years ago
/home/brandon/.pyenv/bin/pyenv
brandon@DeltFall:~
~$ pyenv --version
pyenv 2.0.6

brandon@DeltFall:~
~$ pyenv activate dive
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.

(dive) brandon@DeltFall:~
~$ python --version

Command 'python' not found, did you mean:

  command 'python3' from deb python3
  command 'python' from deb python-is-python3

(dive) brandon@DeltFall:~
~$ pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

(dive) brandon@DeltFall:~
~$ pyenv which pip
/home/brandon/.pyenv/versions/dive/bin/pip

brandon@DeltFall:~
~$ /home/brandon/.pyenv/versions/dive/bin/pip --version
pip 21.1.1 from /home/brandon/.pyenv/versions/3.8.12/envs/dive/lib/python3.8/site-packages/pip (python 3.8)

Pyenv thinks the venv is active, but I'm still getting system pip and there is no python (as expected on a default ubuntu installtion). Both pyenv and pyenv-virtualenv are initialized in my bashrc. pyenv rehash doesn't do anything.

System information

~$ neofetch
            .-/+oossssoo+/-.               brandon@DeltFall 
        `:+ssssssssssssssssss+:`           ---------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.3 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: Precision 5550 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.11.0-27-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 20 hours, 10 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 2013 (dpkg), 8 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 4384x2740 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: GNOME 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Adwaita 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Yaru-dark [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Yaru [GTK2/3] 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: gnome-terminal 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: Intel i7-10750H (12) @ 5.000GHz 
    .ossssssssssssssssssdMMMNysssso.       GPU: Intel UHD Graphics 
      -+sssssssssssssssssyyyssss+-         GPU: NVIDIA Quadro T2000 Mobile / Max-Q 
        `:+ssssssssssssssssss+:`           Memory: 5740MiB / 31859MiB 
            .-/+oossssoo+/-.

What did I do wrong?

native-api commented 3 years ago

How did you create the virtual environment?

You need to create it through Pyenv-Virtualenv for it to correctly manage shims.

native-api commented 3 years ago

Looks like shims are not on your PATH.

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.