152

Is there a way to see what package versions are available with conda? I am getting an error with jupyter but it was working before. Something like yolk?

SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46
pkumar0
  • 2,069
  • 3
  • 14
  • 21

11 Answers11

177

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.

Source: https://docs.conda.io/projects/conda/en/latest/commands/search.html

Daniel Darabos
  • 26,991
  • 10
  • 102
  • 114
The Student Soul
  • 2,272
  • 2
  • 14
  • 12
  • 5
    Hmmm thanks but not sure about `-f` as the docs make no mention of it. In fact `diff <(condaw search -f jupyter) <(condaw search jupyter) |& wc -l` returns `0` for my version of conda: conda 4.7.10 – bgoodr Aug 17 '19 at 16:28
73

You can just type "conda search" which will give you something like the following.

$ conda search 
Fetching package metadata .........
affine                       2.0.0                    py27_0  defaults
                             2.0.0                    py35_0  defaults
                             2.0.0                    py36_0  defaults
alabaster                    0.7.3                    py27_0  defaults
                             0.7.3                    py34_0  defaults
                             0.7.7                    py27_0  defaults
                             0.7.7                    py34_0  defaults
                             0.7.7                    py35_0  defaults
                             0.7.9                    py27_0  defaults
nasica88
  • 1,185
  • 10
  • 10
42

To list packages that are installed on your anaconda machine

conda list

This is to list all packages available for anaconda

conda search
Shahir Ansari
  • 1,682
  • 15
  • 21
22

As an addendum, you can use the output of conda search to fine-tune the version of the package you need installed. E.g. in the list from the 'nasica88', there are three albaster 0.7.7 versions available with with different python versions. If you require e.g. albaster 0.7.7 with python 3.4, you install it as following:

$> conda install albaster=0.7.7=py34_0

So, the second = sign is your friend here.

Ehsan
  • 380
  • 4
  • 9
  • And the `-h` output for `conda search` doesn't clarify the meaning of the two `=` signs, hence my new question at https://stackoverflow.com/q/57538225/257924 – bgoodr Aug 17 '19 at 16:53
13

If you know the name of the package you want to install search for all available versions of it. eg. for package pandas you will do the following

conda search pandas

and then install the version you want using

conda install pandas=1.0.2
user0004
  • 141
  • 1
  • 3
7

To get the version of certain package you can filter it by grep Like:

$ conda list | grep tensorflow

Result:

tensorflow                2.2.0           mkl_py36h5a57954_0  
tensorflow-base           2.2.0           mkl_py36hd506778_0  
tensorflow-estimator      2.2.0              pyh208ff02_0  
Amir Fo
  • 5,163
  • 1
  • 43
  • 51
6

To control specific channels, use -c option. For example:

conda search -c conda-forge jupyterlab

The above will also search in the channels listed in .condarc, so to avoid that (and get results faster) one can use --override-channels:

conda search -c conda-forge --override-channels jupyterlab

To only show versions above a specific release, use "{package}>={release}". For example:

conda search -c conda-forge "jupyterlab>=3.5"

Note that some shells (esp. Windows) do not like single quotes, so using double quotes is safer.

Finally, if you intend to use the output in a program, to avoid parsing the results one can use --json:

conda search -c conda-forge --override-channels --json "jupyterlab>=3.6"

This will return:

{
  "jupyterlab": [
    {
      "arch": null,
      "build": "pyhd8ed1ab_0",
      "build_number": 0,
      "channel": "https://conda.anaconda.org/conda-forge/noarch",
      "constrains": [],
      "depends": [
        "ipython",
        "jinja2 >=2.1",
        "jupyter_core",
        "jupyter_server >=1.16.0,<3",
        "jupyter_server_ydoc >=0.6.0,<0.7.0",
        "jupyter_ydoc >=0.2.2,<0.3",
        "jupyterlab_server >=2.19,<3",
        "nbclassic",
        "notebook <7",
        "packaging",
        "python >=3.7",
        "tomli",
        "tornado >=6.1.0"
      ],
      "fn": "jupyterlab-3.6.0-pyhd8ed1ab_0.conda",
      "license": "BSD-3-Clause",
      "license_family": "BSD",
      "md5": "1a9cd36192678fc2175145c9103b95ff",
      "name": "jupyterlab",
      "noarch": "python",
      "package_type": "noarch_python",
      "platform": null,
      "sha256": "66da471830af4f5a7baa6229240c9dfe0fcc43bf20cc576067dab742bf5ec02e",
      "size": 5827178,
      "subdir": "noarch",
      "timestamp": 1675350928375,
      "url": "https://conda.anaconda.org/conda-forge/noarch/jupyterlab-3.6.0-pyhd8ed1ab_0.conda",
      "version": "3.6.0"
    },
    {
      "arch": null,
      "build": "pyhd8ed1ab_0",
      "build_number": 0,
      "channel": "https://conda.anaconda.org/conda-forge/noarch",
      "constrains": [],
      "depends": [
        "ipython",
        "jinja2 >=2.1",
        "jupyter_core",
        "jupyter_server >=1.16.0,<3",
        "jupyter_server_ydoc >=0.6.0,<0.7.0",
        "jupyter_ydoc >=0.2.2,<0.3",
        "jupyterlab_server >=2.19,<3",
        "nbclassic",
        "notebook <7",
        "packaging",
        "python >=3.7",
        "tomli",
        "tornado >=6.1.0"
      ],
      "fn": "jupyterlab-3.6.1-pyhd8ed1ab_0.conda",
      "license": "BSD-3-Clause",
      "license_family": "BSD",
      "md5": "c7de31a5b57a9fc1aa4d3fb9993819c6",
      "name": "jupyterlab",
      "noarch": "python",
      "package_type": "noarch_python",
      "platform": null,
      "sha256": "8f7d234af44356633f8d418ed3001e814215ff09cedbec9583e3fb10fb7cc5e2",
      "size": 5354015,
      "subdir": "noarch",
      "timestamp": 1675434565845,
      "url": "https://conda.anaconda.org/conda-forge/noarch/jupyterlab-3.6.1-pyhd8ed1ab_0.conda",
      "version": "3.6.1"
    }
  ]
}
SultanOrazbayev
  • 14,900
  • 3
  • 16
  • 46
5

To trim down the long and slowly loading conda search output to just the (latest) version(s) appropriate for your environment, you can use MatchSpec filters, as documented here in conda Github repo

For example:

$ conda search "conda-forge::*[name=scikit-learn, subdir=linux-64, build=*py37*]" | tail -n5
scikit-learn                  0.21.2  py37h627018c_0  conda-forge
scikit-learn                  0.21.2  py37hcdab131_1  conda-forge
scikit-learn                  0.21.3  py37hcdab131_0  conda-forge
scikit-learn                    0.22  py37hcdab131_0  conda-forge
scikit-learn                    0.22  py37hcdab131_1  conda-forge

Note that the most recent version is placed at the bottom of the list (they are sorted in ascending chronological order), so it can be found using tail -n1, e.g.:

$ conda search "conda-forge::*[name=scikit-learn, subdir=linux-64, build=*py38*]" | tail -n1 | awk {'print $2'}
$ 0.23.2

Cautions:

  • using version for narrowing down major and/or minor version is risky, because version=1.*.* would miss versions such as 1.1 or 1,

  • setting architecture (using subdir key) to linux-64 can miss some useful linux 64-bit packages, if they are stored in the noarch folder instead of linux-64

Nathan S. Watson-Haigh
  • 5,043
  • 2
  • 19
  • 19
mirekphd
  • 4,799
  • 3
  • 38
  • 59
3

I installed pip in conda, so pip list also works

Yuchen
  • 81
  • 5
1

conda list <pattern> works too.

    (base) root@fb7969c44a12:/# conda list jupyterlab
    # packages in environment at /opt/conda:
    #
    # Name                    Version                   Build  Channel
    beatrix-jupyterlab        2023.46.184821           pypi_0    pypi
    jupyterlab                3.6.3                    pypi_0    pypi
    jupyterlab-git            0.41.0                   pypi_0    pypi
    jupyterlab-lsp            4.0.1                    pypi_0    pypi
    jupyterlab-server         2.22.0                   pypi_0    pypi
    jupyterlab-widgets        3.0.7                    pypi_0    pypi
    jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
Maciej Skorski
  • 2,303
  • 6
  • 14
0

example with cudatoolkit:

conda search -c nvidia cudatoolkit
mrr7997
  • 11
  • 3