Answers.Body: <p>To my knowledge there's no single listing of the licenses, but you can:</p>
  
  <pre><code>conda list | awk '{if(NR&gt;3) printf("%s=%s", <span class="math-container">$1, $</span>2)}' | xargs conda info | grep license
  </code></pre>
  
  <p>Allegedly <code>conda info --license</code> should work, but at least in conda 4.6.3 it doesn't show any license information. It unfortunate that there's no convenient way to get a tabular list of package:version:channel:license information from the command line.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-20T16:17:43.983Z
Answers.Text: It doesn't work for me, I get InvalidVersionSpec: Invalid version '0.1.0_license=1.1_r-mutex=1.0.0_tflow_180_select=3.0_tflow_select=2.1.0absl-py=0.2.2ad3=2.2.1alabaster=0.7.10anaconda-client=1.6.14anaconda-navigator=1.8.7anaconda-project=0.8.2anyqt=0.0.8appdirs=1.4.3argcomplete=1.9.4asn1crypto=0.24.0astor=0.6.2astroid=1.6.3astropy=3.0.2atomicwrites=1.1.5attrs=18.1.0awscli=1.15.57babel=2.5.3backcall=0.1.0backports=1.0backports.sh ... etc BTW, I can edit your response, isn't that strange? Conda version 4.6.3. Conda list does not seem to output any licenses.
Answers.UserDisplayName: Freek
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-20T16:47:27.223Z
Answers.Text: Try adding a `\n` in the printf (`"%s=%s\n"`). Regarding the edit, it would become a suggestion and I'd get a notice for approval.
Answers.UserDisplayName: Devon Ryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-21T13:56:13.930Z
Answers.Text: Thanx, this does produce a list of licences indeed! However, I don't see what they belong to. I also don't understand how your command works otherwise I would distill from it something that prints a packages name and a license only. What does the command do? There are no licences in the conda list output so where do they come from? How would I get the license for one package?
Answers.UserDisplayName: Freek
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-12T08:00:33.833Z
Answers.LastActivityDate: 2019-02-12T08:00:33.833Z
Answers.UserDisplayName: Devon Ryan
Answers.Body: <p>This one uses JQ for parsing and querying conda generated json output (<a href="https://stedolan.github.io/jq/" rel="nofollow noreferrer">https://stedolan.github.io/jq/</a>)</p>
  
  <pre><code>conda list | awk '{if(NR&gt;3) printf("%s=%s\n", <span class="math-container">$1, $</span>2)}' | xargs -I{} conda search --info --json "{}" | jq --raw-output '.[][0] | "\(.name)\t\(.version)\t\(.license)"'
  </code></pre>
  
  <p>builds the list, asks conda search for all info on package as json, feeds json to JQ, which selects the first item and outputs its name, version and license as tsv.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-24T16:45:53.127Z
Answers.Text: I like this solution, although it does take a bit of time, since `conda search` queries aren't that fast. The only problem I ran into is if you have a later version of conda installed where the command line `conda` is actually a function, not an executable file, you'll need to changes `... xargs -I{} conda ..` to `... xargs -I{} $CONDA_EXE ...`.
Answers.UserDisplayName: James Hawley
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-24T14:22:49.057Z
Answers.LastActivityDate: 2020-01-24T14:22:49.057Z
Answers.UserDisplayName: Luuk Peters
Answers.Body: <p>I can't comment, but here's an improvement for the top answer to list more information:</p>
  <pre><code>conda list | awk '{if(NR&gt;3) printf(&quot;%s=%s\n&quot;, <span class="math-container">$1, $</span>2)}' | xargs conda info | grep 'name\|version\|license'
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-28T16:36:27.797Z
Answers.LastActivityDate: 2022-10-01T04:40:59.277Z
Answers.LastEditDate: 2022-10-01T04:40:59.277Z
Answers.UserDisplayName: Tom Sproul
Body: <p>I would like to get a list of the licenses of all packages I installed using Conda. pip has what I need in the form of <a href="https://pypi.org/project/pip-licenses/" rel="noreferrer">pip-licenses</a>, is there a similar thing for conda?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-12T03:57:48.090Z
Comments.Text: I proposed `grep '"license":' ${CONDA_PREFIX}/conda-meta/*.json` in [a similar SO query](https://stackoverflow.com/q/57549777/570918).
Comments.UserDisplayName: merv
Tags: <bioconda><conda>
Title: Getting the licenses of all conda installed packages
ThreadText: # Getting the licenses of all conda installed packages
  
  (Asked by: username_0 on 2019-02-12)
  
  I would like to get a list of the licenses of all packages I installed using Conda. pip has what I need in the form of [pip-licenses](https://pypi.org/project/pip-licenses/), is there a similar thing for conda?
  
  **Tags:** bioconda, conda
  
  > **Comments:**
  > **username_1**: I proposed `grep '"license":' ${CONDA_PREFIX}/conda-meta/*.json` in [a similar SO query](https://stackoverflow.com/q/57549777/570918).  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2019-02-12. Score: 7
  
  To my knowledge there's no single listing of the licenses, but you can:
  
  ```
  conda list | awk '{if(NR>3) printf("%s=%s", $1, $2)}' | xargs conda info | grep license
  
  ```
  
  Allegedly `conda info --license` should work, but at least in conda 4.6.3 it doesn't show any license information. It unfortunate that there's no convenient way to get a tabular list of package:version:channel:license information from the command line.
  
  > **Comments:**
  > **username_0**: It doesn't work for me, I get InvalidVersionSpec: Invalid version '0.1.0_license=1.1_r-mutex=1.0.0_tflow_180_select=3.0_tflow_select=2.1.0absl-py=0.2.2ad3=2.2.1alabaster=0.7.10anaconda-client=1.6.14anaconda-navigator=1.8.7anaconda-project=0.8.2anyqt=0.0.8appdirs=1.4.3argcomplete=1.9.4asn1crypto=0.24.0astor=0.6.2astroid=1.6.3astropy=3.0.2atomicwrites=1.1.5attrs=18.1.0awscli=1.15.57babel=2.5.3backcall=0.1.0backports=1.0backports.sh ... etc BTW, I can edit your response, isn't that strange? Conda version 4.6.3. Conda list does not seem to output any licenses.  
  > **username_2**: Try adding a `\n` in the printf (`"%s=%s\n"`). Regarding the edit, it would become a suggestion and I'd get a notice for approval.  
  > **username_0**: Thanx, this does produce a list of licences indeed! However, I don't see what they belong to. I also don't understand how your command works otherwise I would distill from it something that prints a packages name and a license only. What does the command do? There are no licences in the conda list output so where do they come from? How would I get the license for one package?  
  
  ---
  
  ### Answer by username_3 on 2020-01-24. Score: 1
  
  This one uses JQ for parsing and querying conda generated json output (<https://stedolan.github.io/jq/>)
  
  ```
  conda list | awk '{if(NR>3) printf("%s=%s\n", $1, $2)}' | xargs -I{} conda search --info --json "{}" | jq --raw-output '.[][0] | "\(.name)\t\(.version)\t\(.license)"'
  
  ```
  
  builds the list, asks conda search for all info on package as json, feeds json to JQ, which selects the first item and outputs its name, version and license as tsv.
  
  > **Comments:**
  > **username_4**: I like this solution, although it does take a bit of time, since `conda search` queries aren't that fast. The only problem I ran into is if you have a later version of conda installed where the command line `conda` is actually a function, not an executable file, you'll need to changes `... xargs -I{} conda ..` to `... xargs -I{} $CONDA_EXE ...`.  
  
  ---
  
  ### Answer by username_5 on 2022-09-28. Score: 1
  
  I can't comment, but here's an improvement for the top answer to list more information:
  
  ```
  conda list | awk '{if(NR>3) printf("%s=%s\n", $1, $2)}' | xargs conda info | grep 'name\|version\|license'
  
  ```
  
  
  ---
  
  