I am using both "pip freeze" and "conda list" to list the packages installed in my environment, but what are their differences?
-
http://stackoverflow.com/a/33694864/1005215 – Nehal J Wani Jan 19 '17 at 08:13
-
see http://stackoverflow.com/questions/18640305/how-do-i-keep-track-of-pip-installed-packages-in-an-anaconda-conda-environment – Kuppu May 12 '17 at 15:38
-
2I have packages in my conda env that some were installed with conda and others were installed with pip (due to how libraries are support only in pip and that I use conda). So do I need to generate two `requiremen_{pip or conda}.py`? Or how do I solve this issue and install everything correctly? – Charlie Parker Apr 23 '21 at 18:01
1 Answers
If the goal only is to list all the installed packages, pip list
or conda list
are the way to go.
pip freeze
, like conda list --export
, is more for generating requirements files for your environment. For example, if you have created a package in your customized environment with certain dependencies, you can do conda list --export > requirements.txt
. When you are ready to distribute your package to other users, they can easily duplicate your environment and the associated dependencies with conda create --name <envname> --file requirements.txt
.
The differences between conda
and pip
need a longer discussion. There are plenty of explanations on StackOverflow. This article by Jake VanderPlas is a great read as well.
You might also find this table useful. It lists operation equivalences between conda
, pip
and virtualenv
.
-
1
-
1Thanks a lot for noticing this! I wonder if this has something to do with the fact that fewer people could need `virtualenv` these days (`pyenv` and `pipenv` might have become the more dominant forces). Just corrected the link and limited the comparison to be between `pip` and `conda` (`virtualenv` no longer listed). – Shan Dou Aug 19 '19 at 15:50
-
5This site is my docs - always like to fix em ;-) - I added virtualenv again (it's in the table if you scroll right), feel free to delete the reference to it if you feel it reads better. (: – drevicko Aug 20 '19 at 01:57
-
3I came here looking for `conda list --export`. Consider another question answered from someone starting out with conda after using pip first. – rocksNwaves Aug 07 '20 at 22:26
-
While my code is running without any error, when I follow the "conda list --export > requirements.txt" and "conda create --name
--file requirements.txt" I got "Found conflicts! Looking for incompatible packages." , and cannot create environment. Any idea ? – ugurtosun Mar 17 '21 at 14:32 -
@UğurGürkanTosun I don't see explicit issues in syntax. It is possible that you may not have started with a clean-slate environment when first running the codes (so the requirement file may have included pieces you don't need for your codes). Also, there is a difference between static and dynamic environment file. If you manage your environment entirely with conda, please also consider using yaml instead and only dictates versions when you truly need to. A good example can be seen in pyjantor repo: https://github.com/ericmjl/pyjanitor/blob/dev/environment-dev.yml – Shan Dou Mar 21 '21 at 05:03
-
I have packages in my conda env that some were installed with conda and others were installed with pip (due to how libraries are support only in pip and that I use conda). So do I need to generate two `requiremen_{pip or conda}.py`? Or how do I solve this issue and install everything correctly? – Charlie Parker Apr 23 '21 at 18:01
-
@CharlieParker Since we can always use pip within a conda environment, you don't need to have two separate files. For example, when you run `conda list`, you should see `Build` and `Channel` columns clearly indicate if a package is installed via conda or pip: ```python # Name. Version. Build. Channel pygments 2.8.1 pypi_0 pypi pyparsing 2.4.7 pypi_0 pypi python 3.9.2 h2502468_0_cpython conda-forge ``` – Shan Dou Apr 24 '21 at 04:13