Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare packages between two anaconda installations

I had two versions of Python, with Anaconda, installed in my Mac, 3.5 and 3.7. Is there any way to know what packages I had installed in 3.5 that are not in 3.7, like those that you can install with pip (pulp, wordcloud, and alike).

What I have tried so far is using command line with this:

diff -rq anaconda/.../python3.5/site-packages anaconda3/.../python3.7/site-packages

This shows the differences between the directories but shows a lot of information of repeated packages and core modules. How can I find the differences in packages between two Anaconda versions?

like image 873
Ivan Calderon Avatar asked Jun 04 '19 17:06

Ivan Calderon


1 Answers

You can list all the packages installed under a specific environment using conda list. Also, you can export the list to a file with the flag --export. For example, if your environments are named python3 and pytorch_p36, you can do the following:

conda list -n python3 --export > python3-packages.txt
conda list -n pytorch_p36 --export > pytorch_p36-packages.txt
diff python3-packages.txt pytorch_p36-packages.txt

The command also accepts the flag --json, which will export the data in a json format, suitable for automatic processing.

like image 200
dataista Avatar answered Oct 14 '22 03:10

dataista