Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I list my pip-installed packages inside a venv?

I have successfully activated a virtual environment and installed packages there, but when I try to list those packages with pip list I get the list of global packages, not those in the activated venv.

$ source ./venv/bin/activate
[venv] pip list
# ... global 2.7 packages are listed
[venv] pip3 list
# ... global 3 packages are listed

but

$ cd venv/lib/pythonXX/site-packages
$ ls
# ...venv's installed packages are listed

even though python -version correctly lists the venv's Python (and not any global version).

How do I list my pip-installed packages inside a venv?

like image 681
orome Avatar asked Jan 08 '18 23:01

orome


People also ask

Does pip install in venv?

Installing virtualenv virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.

Which command will display all of the packages installed in the virtual environment?

Pipenv. This command will list all packages installed, including any dependencies that are found in a Pipfile. lock file.


1 Answers

I resolved this problem by creating a new venv for my project and switch to it. Then, when I activate the venv and "pip list" into it, I list only venv packages. I think this problem happens when you rename project folder or venv folder or move those files maybe to reorganise your project structure.

like image 109
Pozinux Avatar answered Sep 21 '22 08:09

Pozinux