pip freeze does not show all installed packages
Asked Answered
G

8

22

I am using a virtualenv. I have fabric installed, with pip. But a pip freeze does not give any hint about that. The package is there, in my virtualenv, but pip is silent about it. Why could that be? Any way to debug this?

Guimpe answered 6/6, 2013 at 10:50 Comment(1)
Are you using the pip from the virtualenv?Groth
E
7

I just tried this myself:

create a virtualenv in to the "env" directory:

$virtualenv2.7 --distribute env
New python executable in env/bin/python
Installing distribute....done.
Installing pip................done.

next, activate the virtual environment:

$source env/bin/activate

the prompt changed. now install fabric:

(env)$pip install fabric
Downloading/unpacking fabric
  Downloading Fabric-1.6.1.tar.gz (216Kb): 216Kb downloaded
  Running setup.py egg_info for package fabric   
...

Successfully installed fabric paramiko pycrypto
Cleaning up...

And pip freeze shows the correct result:

(env)$pip freeze
Fabric==1.6.1
distribute==0.6.27
paramiko==1.10.1
pycrypto==2.6
wsgiref==0.1.2

Maybe you forgot to activate the virtual environment? On a *nix console type which pip to find out.

Enumeration answered 6/6, 2013 at 11:10 Comment(4)
Oooooops. I was doing (silly me) pip freeze | grep fabric (I have lots of packets installed). I could swear I have scanned manually the whole list, but somehow I skipped that. Strange that it is installed as Fabric, but anyway not a very good performance on my side.Guimpe
grep -i is my friend too :)Enumeration
yep! usually I would run grep -i before trying anything else, but in this case I was so convinced that it should be fabric that I did not even consider that. I mean, who on the fabric team came up with the idea of breaking a years-long tradition of using lower case for package names? :) Specially when the package is called fabric on pypi.Guimpe
Maybe the same people who register django as Django?Enumeration
B
8

You can try using the --all flag, like this:

pip freeze --all > requirements.txt
Bully answered 29/7, 2020 at 13:14 Comment(0)
E
7

I just tried this myself:

create a virtualenv in to the "env" directory:

$virtualenv2.7 --distribute env
New python executable in env/bin/python
Installing distribute....done.
Installing pip................done.

next, activate the virtual environment:

$source env/bin/activate

the prompt changed. now install fabric:

(env)$pip install fabric
Downloading/unpacking fabric
  Downloading Fabric-1.6.1.tar.gz (216Kb): 216Kb downloaded
  Running setup.py egg_info for package fabric   
...

Successfully installed fabric paramiko pycrypto
Cleaning up...

And pip freeze shows the correct result:

(env)$pip freeze
Fabric==1.6.1
distribute==0.6.27
paramiko==1.10.1
pycrypto==2.6
wsgiref==0.1.2

Maybe you forgot to activate the virtual environment? On a *nix console type which pip to find out.

Enumeration answered 6/6, 2013 at 11:10 Comment(4)
Oooooops. I was doing (silly me) pip freeze | grep fabric (I have lots of packets installed). I could swear I have scanned manually the whole list, but somehow I skipped that. Strange that it is installed as Fabric, but anyway not a very good performance on my side.Guimpe
grep -i is my friend too :)Enumeration
yep! usually I would run grep -i before trying anything else, but in this case I was so convinced that it should be fabric that I did not even consider that. I mean, who on the fabric team came up with the idea of breaking a years-long tradition of using lower case for package names? :) Specially when the package is called fabric on pypi.Guimpe
Maybe the same people who register django as Django?Enumeration
P
5

Although your problem was specifically due to a typo, to help other users:

pip freeze doesn't show the dependencies that pip depends on. If you want to obtain all packages you can use pip freeze --all or pip list.

Plantain answered 2/8, 2019 at 19:33 Comment(0)
W
1

If you have redirected all the pre-installed packages in a file named pip-requirements.txt then it is pretty simple to fix the above issue.

1) Delete your virtualenv folder or create new one (I am giving it a name as venv)

rm -rf venv && virtualenv venv

2) Install all the requirements/dependencies from the pip-requirements.txt

pip install -r pip-requirements.txt

3) Now you can check the installed packages for your Django application

pip freeze

4) If you had forgotten to update your requirements file(pip-requirements.txt), then install fabric again (Optional Step)

Note: After installing any dependency for your Django app, always update the requirements in any file as follows (make sure your virtualenv is activated)

pip freeze > pip requirements.txt

That's it.

Wood answered 20/7, 2017 at 7:8 Comment(0)
I
1

Adding my fix in addition of above fix also , I was also facing the same issue on windows,even after activating the virtualenv too pip freeze was not giving me all list of installed packages. So i upgraded my pip with python -m pip install --upgrade pip command and then used pip freeze. This time it worked and gave me all list of installed packages.

Iglesias answered 31/1, 2020 at 17:22 Comment(0)
H
0

This might be stupid but I have got the same problem. I solved it by refreshing vs code file directory (inside vscode there is a reload button). :)

Hammerless answered 5/1, 2021 at 10:2 Comment(0)
S
0

If none of the above answers are working for you. As with me you might have problem in you venv and pip configuration.

Go inside your venv/bin and open pip and see the 2nd line as: '''exec' "path/to/yourvenv/bin/python3" "$0" "$@"

See if this line is correctly pointing inside your venv or not For example in my case. I initially named my virtual environment as venv1 and later just renamed it to venv2. In doing so my pip file 2nd line had: '''exec' "venv1/bin/python3" "$0" "$@" which to work properly should have: '''exec' "venv2/bin/python3" "$0" "$@" notice "venv2" not "venv1" since venv1 in now renamed to venv2.

Due to this python was looking inside pip of venv2 and throwing error or not working as desired.

Sinuosity answered 19/11, 2021 at 10:13 Comment(0)
R
0

For those who added Python modules via PyCharm IDE, after generating a virtual environment from the command prompt, good luck! You will need to rebuild the requirements.txt file manually with the ones missing by first running pip3 freeze and adding what is missing from PyCharm.

I highly suggest switching to Visual Studio Code.

Renwick answered 14/4, 2022 at 22:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.