I'm on a Linux/Ubuntu system, in a folder designated by pyenv as Python 3.8.1. I've install pipx using pip install pipx
. If I install an application (cowsay), and activate the virtual environment for the application, pip lists my globally installed packages. Why I'm I not seeing the site packages for the cowsay install when the virtual environment is activated?
You can see from the example below that pip list
gives me the same result regardless of the activation status of the virtualenv? I know that during project development, this is not the observed response. When inside a venv, pip list gives me the site packages installed in the venv.
pipx --verion
0.15.5.1
pip --version
pip 20.2.3 from /home/steve/.pyenv/versions/3.8.1/lib/python3.8/site-packages/pip (python 3.8)
cd /home/steve/.local/pipx/venvs/
source activate cowsay/bin/activate
(cowsay):~/.local/pipx/venvs$ pip list
Package Version
----------- --------
argcomplete 1.12.1
click 7.1.2
distro 1.5.0
packaging 20.4
pip 20.2.3
pipx 0.15.5.1
pyparsing 2.4.7
setuptools 41.2.0
six 1.15.0
userpath 1.4.1
(cowsay) :~/.local/pipx/venvs$ deactivate
:~/.local/pipx/venvs$ pip list
Package Version
----------- --------
argcomplete 1.12.1
click 7.1.2
distro 1.5.0
packaging 20.4
pip 20.2.3
pipx 0.15.5.1
pyparsing 2.4.7
setuptools 41.2.0
six 1.15.0
userpath 1.4.1
Your
pip
command is not actually using the venv. Checkingtype pip
will tell you where it is really resolved.pipx
won't create a console script forpip
within the venv, because there is no need.The console scripts created for the venv, including a
cowsay
executable and apython
symlink on $PATH, will be under:But the console script for the pip installation will have been created under a location which is not on $PATH:
You should still be able to see cowsay lib within the actual venv like this:
You might wonder why
python -m pip
is working whenpip
is not? In fact, the pip installation is shared between venvs, and you should be able to see the path file hack which sets that up here: