How to list package versions available with conda

前端 未结 6 1299
花落未央
花落未央 2021-02-03 16:59

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?

相关标签:
6条回答
  • 2021-02-03 17:19

    To list packages that are installed on your anaconda machine

    conda list
    

    This is to list all packages available for anaconda

    conda search
    
    0 讨论(0)
  • 2021-02-03 17:23

    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
    
    0 讨论(0)
  • 2021-02-03 17:23

    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

    0 讨论(0)
  • 2021-02-03 17:25

    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

    0 讨论(0)
  • 2021-02-03 17:36

    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
    
    0 讨论(0)
  • 2021-02-03 17:37

    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.

    0 讨论(0)
提交回复
热议问题