Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conda environment: Print licenses of installed packages

is there an easy way to print the license of each package in a conda environment?

conda list nicely lists all packages, however there is no option to get information about the license. On Anaconda the license is shown.

I tried to find the licenses in each package folder, but was not lucky. Is the only option to look at each package individually on Anaconda.org?

Conda version 4.6.14

Thanks

like image 516
Michael Avatar asked Aug 19 '19 02:08

Michael


People also ask

How do I list installed packages in conda environment?

in terminal, type : conda list to obtain the packages installed using conda.

How do I see pip installed packages in conda environment?

Use pip installed with conda , e.g. ~/anaconda/bin/pip . Use it to install packages into a conda environment, as well as to see the union of packages installed with this pip and with conda install .

How do I check my conda package?

To search for a specific package, use: conda search -f <package_name> . For example, based on the question, to search all versions for "jupyter" package, you'll do: conda search -f jupyter . This will only return information about packages named "jupyter" exactly.

How do I check my conda Environment list?

To list any variables you may have, run conda env config vars list . To set environment variables, run conda env config vars set my_var=value . Once you have set an environment variable, you have to reactivate your environment: conda activate test-env .


Video Answer


1 Answers

You can find it in the JSON files under the conda-meta folder in each env. The key license is in the main object, if you're looking to parse the JSON. Otherwise, you can get a quick look with:

grep '"license":' conda-meta/*.json

which outputs the following (abridged) for me:

conda-meta/aioeasywebdav-2.4.0-py37_1000.json:  "license": "ISC",
conda-meta/aiohttp-3.5.4-py37h1de35cc_0.json:  "license": "Apache 2.0",
conda-meta/appdirs-1.4.3-py37h28b3542_0.json:  "license": "MIT",
conda-meta/appnope-0.1.0-py37_0.json:  "license": "BSD 2-Clause",
conda-meta/asn1crypto-0.24.0-py37_0.json:  "license": "MIT",
...
conda-meta/xz-5.2.4-h1de35cc_4.json:  "license": "LGPL-2.1 and GPL-2.0",
conda-meta/yaml-0.1.7-hc338f04_2.json:  "license": "MIT",
conda-meta/yarl-1.3.0-py37h1de35cc_0.json:  "license": "Apache 2.0",
conda-meta/zeromq-4.2.5-h0a44026_1.json:  "license": "LGPL 3",
conda-meta/zlib-1.2.11-h1de35cc_3.json:  "license": "zlib",
like image 151
merv Avatar answered Oct 21 '22 03:10

merv