哪个包使conda降级包?

问题描述 投票:1回答:1

我正在使用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 anaconda conda
1个回答
0
投票

尝试从您的环境运行以下脚本。对我来说,它将一切都链接到Python 3.6.6,尽管它在xgboost不可用时失败了。你的环境可能会有所不同。它只是用qthon脚本包装conda create以使其独立于操作系统。它在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')))

可能更防守,但我太懒了,对不起:)

© www.soinside.com 2019 - 2024. All rights reserved.