哪个包使 conda 降级包?

Which package makes conda downgrade a package?

我正在使用以下命令安装相当长的 conda 软件包列表:

conda install -c conda-forge \
    'nomkl' \
    'ipywidgets=7.4.0' \
    'pandas=0.23.4' \
    'numexpr=2.6.5' \
    'matplotlib=2.2.2' \
    'scipy=1.1.0' \
    'seaborn=0.9.0' \
    'scikit-learn=0.19.1' \
    'scikit-image=0.14.0' \
    'sympy=1.2' \
    'cython=0.28.5' \
    'patsy=0.5.0' \
    'statsmodels=0.8.0' \
    'dill=0.2.8.2' \
    'numba=0.38.1' \
    'bokeh=0.13.0' \
    'sqlalchemy=1.2.10' \
    'hdf5' \
    'libnetcdf' \
    'netcdf4' \
    'h5py=2.8.0' \
    'vincent=0.4.4' \
    'beautifulsoup4=4.6.1' \
    'protobuf=3.6.0' \
    'tensorflow=1.10' \
    'opencv' \
    'keras=2.1' \
    'dask=0.19.0' \
    'dask-glm=0.1.0' \
    'dask-ml=0.9.0' \
    'dask-xgboost=0.1.5' \
    'dask-kubernetes=0.5.0' \
    'msgpack-python' \
    'distributed=1.23' \
    'cloudpickle=0.5.3' \
    'python-blosc' \
    'numpy=1.14.2' \
    'xarray=0.10.8' \
    'gcsfs=0.1.2' \
    'pymc3=3.5' \
    'hdbscan=0.8.15' \
    'pystan=2.17.1.0' \
    'yaafe=0.70' \
    'aubio=0.4.6' \
    'librosa=0.6.2' \
    'nltk=3.2.5' \
    'spacy=2.0.11' \
    'gensim=3.5.0' \
    'textblob=0.15.1' \
    'xlrd=1.1.0'  && \
    conda clean -tipsy

作为副作用,会发生以下降级:

python: 3.6.5-1 conda-forge --> 3.5.5-1

这实际上破坏了我的环境,因为我依赖 Python 3.6.

检查哪个包导致降级的最佳方法是什么?也许有办法修复 Python 版本并使 conda 在不满足约束的包上抛出错误?

从您的环境中尝试 运行 以下脚本。对我来说,它将所有内容链接到 Python 3.6.6,尽管它在 xgboost 不可用时失败。您的环境可能会有所不同。它只是用 python 脚本包装 conda create 以使其 OS 独立。它在 Windows.

上使用 Python 3.6.6 进行了测试
from subprocess import run, PIPE, DEVNULL
import json

deps = ['dask-xgboost=0.1.5', 'nomkl', 'ipywidgets=7.4.0', 'pandas=0.23.4', 'numexpr=2.6.5', 'matplotlib=2.2.2', 'scipy=1.1.0', 'seaborn=0.9.0', 'scikit-learn=0.19.1', 'scikit-image=0.14.0', 'sympy=1.2', 'cython=0.28.5', 'patsy=0.5.0', 'statsmodels=0.8.0', 'dill=0.2.8.2', 'numba=0.38.1', 'bokeh=0.13.0', 'sqlalchemy=1.2.10', 'hdf5', 'libnetcdf', 'netcdf4', 'h5py=2.8.0', 'vincent=0.4.4', 'beautifulsoup4=4.6.1', 'protobuf=3.6.0', 'tensorflow=1.10',     'opencv', 'keras=2.1', 'dask=0.19.0', 'dask-glm=0.1.0', 'dask-ml=0.9.0', 'dask-kubernetes=0.5.0', 'msgpack-python', 'distributed=1.23']

for d in deps:
    links = run('conda create --dry-run --json -n dummy ' + d, stdout=PIPE, stderr=DEVNULL)
    if links.returncode == 0:
        links = json.loads(links.stdout)
        if 'actions' in links:
            links = links['actions']['LINK']
            p = [l for l in links if l['name'] == 'python']
            if len(p): print("{} links python={}".format(d, p[0]['version']))
            else: print("{} - no python".format(d))
        else: print("{} - no actions".format(d))
    else: print("{} failed: {}".format(d, links.stdout.decode('ascii')))

还可以再防守一些,但是我太懒了,抱歉:)