A comparison of outputs reveals differences:
user@user-VirtualBox:~$ pip list
feedparser (5.1.3)
pip (1.4.1)
setuptools (1.1.5)
wsgiref (0.1.2)
user@user-VirtualBox:~$ pip freeze
feedparser==5.1.3
wsgiref==0.1.2
Pip's documentation states
freeze Output installed packages in requirements format.
list List installed packages.
but what is "requirements format," and why does pip list
generate a more comprehensive list than pip freeze
?
When you are using a
virtualenv
, you can specify arequirements.txt
file to install all the dependencies.A typical usage:
The packages need to be in a specific format for
pip
to understand, which isThat is the "requirements format".
Here,
django==1.4.2
implies installdjango
version1.4.2
(even though the latest is 1.6.x). If you do not specify==1.4.2
, the latest version available would be installed.You can read more in "Virtualenv and pip Basics", and the official "Requirements File Format" documentation.
The main difference is that the output of
pip freeze
can be dumped into a requirements.txt file and used later to re-construct the "frozen" environment.In other words you can run:
pip freeze > frozen-requirements.txt
on one machine and then later on a different machine or on a clean environment you can do:pip install -r frozen-requirements.txt
and you'll get the an identical environment with the exact same dependencies installed as you had in the original environment where you generated the frozen-requirements.txt.Look at the pip documentation, which describes the functionality of both as:
pip list
pip freeze
So there are two differences:
Output format,
freeze
gives us the standard requirement format that may be used later withpip install -r
to install requirements from.Output content,
pip list
include editables whichpip freeze
does not.To answer the second part of this question, the two packages shown in
pip list
but notpip freeze
aresetuptools
(which is easy_install) andpip
itself.It looks like
pip freeze
just doesn't list packages that pip itself depends on. You may use the--all
flag to show also those packages.From the documentation: