How to list package versions available with conda

前端 未结 6 1405
花落未央
花落未央 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: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

提交回复
热议问题