conda install matplotlib 导致巨大的不兼容性列表

Posted

技术标签:

【中文标题】conda install matplotlib 导致巨大的不兼容性列表【英文标题】:conda install matplotlib results in huge list on incompatibilities 【发布时间】:2022-01-19 17:23:51 【问题描述】:

我有一个 conda env,它是从一个同学那里获得的 requirements.yml 文件构建的,因此我们可以一起开展一个项目。我尝试安装 matplotlib,但它导致了一个巨大的不兼容列表,我认为我什至无法开始手动解决。

这是我正在使用的最重要的包(在我看过的其他几篇文章中出现的包以及错误的样子):

python 3.9.7 张量流 2.6.0 anaconda 4.11 numpy 1.21.2 龙卷风 6.1

有没有办法解决这个问题而不涉及到错误的每一行?:

具体包含matplotlib不兼容的部分错误:

- matplotlib -> cycler[version='>=0.10'] -> six[version='>=1.5']
  - matplotlib -> libpng[version='>=1.6.32,<1.7.0a0|>=1.6.34,<1.7.0a0|>=1.6.35,<1.7.0a0|>=1.6.36,<1.7.0a0|>=1.6.37,<1.7.0a0']
  - matplotlib -> matplotlib-base[version='>=3.5.0,<3.5.1.0a0'] -> numpy[version='>=1.15.4,<2.0a0|>=1.16.6,<2.0a0|>=1.19.2,<2.0a0']
  - matplotlib -> matplotlib-base[version='>=3.5.0,<3.5.1.0a0'] -> packaging[version='>=20.0']
  - matplotlib -> matplotlib-base[version='>=3.5.0,<3.5.1.0a0'] -> pyparsing[version='>=2.0.3,!=2.0.4,!=2.1.2,!=2.1.6|>=2.2.1']
  - matplotlib -> matplotlib-base[version='>=3.5.0,<3.5.1.0a0'] -> python-dateutil[version='>=2.1|>=2.7']
  - matplotlib -> numpy[version='>=1.14.6,<2.0a0'] -> blas[version='*|1.0',build=mkl]
  - matplotlib -> numpy[version='>=1.14.6,<2.0a0'] -> icc_rt[version='>=13.1.6|>=2019.0.0|>=16.0.4']
  - matplotlib -> numpy[version='>=1.14.6,<2.0a0'] -> mkl-service[version='>=2,<3.0a0|>=2.3.0,<3.0a0']
  - matplotlib -> numpy[version='>=1.14.6,<2.0a0'] -> mkl[version='>=2018.0.0,<2019.0a0|>=2018.0.1,<2019.0a0|>=2018.0.2,<2019.0a0|>=2018.0.3,<2019.0a0|>=2019.1,<2021.0a0|>=2019.3,<2021.0a0|>=2019.4,<2021.0a0|>=2021.2.0,<2022.0a0|>=2021.3.0,<2022.0a0|>=2019.4,<2020.0a0']
  - matplotlib -> numpy[version='>=1.14.6,<2.0a0'] -> mkl_random[version='>=1.0.2,<2.0a0|>=1.2.1,<2.0a0|>=1.0.4,<2.0a0']
  - matplotlib -> numpy[version='>=1.14.6,<2.0a0'] -> numpy-base[version='1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.11.3|1.14.3|1.14.3|1.14.3|1.14.4|1.14.4|1.14.4|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.5|1.14.6|1.14.6|1.14.6|1.14.6|1.14.6|1.14.6|1.14.6|1.14.6|1.15.0|1.15.0|1.15.0|1.15.0|1.15.1|1.15.1|1.15.1|1.15.1|1.15.2|1.15.2|1.15.2|1.15.2|1.15.2|1.15.3|1.15.3|1.15.3|1.15.4|1.15.4|1.15.4|1.15.4|1.15.4|1.15.4|1.16.0|1.16.0|1.16.0|1.16.0|1.16.0|1.16.0|1.16.1|1.16.1|1.16.1|1.16.1|1.16.1|1.16.1|1.16.2|1.16.2|1.16.2|1.16.3|1.16.3|1.16.3|1.16.4|1.16.4|1.16.5|1.16.5|1.16.5|1.16.6|1.16.6|1.16.6|1.16.6|1.16.6|1.16.6|1.16.6|1.16.6|1.16.6|1.17.2.*|1.17.3.*|1.17.4.*|1.18.1.*|1.18.5.*|1.19.1|1.19.1|1.19.1|1.19.2|1.19.2|1.19.2|1.19.2|1.20.1|1.20.1|1.20.1|1.20.2|1.20.2|1.20.2|1.20.3|1.20.3|1.20.3|1.21.2|1.17.0|1.17.0|1.9.3|1.9.3|1.9.3|1.9.3|1.9.3|1.9.3|1.9.3|>=1.9.3,<2.0a0',build='py27h0bb1d87_7|py35h5c71026_7|py36h5c71026_7|py27h0bb1d87_8|py35h4a99626_9|py27hfef472a_9|py37h8128ebf_9|py36h8128ebf_9|py35h8128ebf_9|py27h2753ae9_9|py27h2753ae9_10|py36h8128ebf_11|py37h2a9b21d_11|py36h2a9b21d_11|py27hb1d0314_11|py37hc3f5095_12|py38hc3f5095_12|py27h917549b_1|py35h5c71026_0|py27h0bb1d87_0|py35h5c71026_0|py27h0bb1d87_0|py27h0bb1d87_1|py36h5c71026_1|py37h5c71026_2|py27h0bb1d87_2|py27h0bb1d87_3|py36h5c71026_3|py27h0bb1d87_4|py37h5c71026_4|py36h5c71026_4|py35h4a99626_4|py37h8128ebf_4|py27h2753ae9_4|py35h8128ebf_4|py38hc3f5095_4|py37hc3f5095_5|py27hb1d0314_5|py36hc3f5095_5|py35h4a99626_0|py37h4a99626_0|py37h8128ebf_0|py35h8128ebf_0|py27h2753ae9_0|py36h8128ebf_0|py35h8128ebf_0|py37h8128ebf_0|py36h8128ebf_0|py37h8128ebf_0|py27h2753ae9_0|py37h8128ebf_0|py36h8128ebf_0|py36hc3f5095_0|py27hb1d0314_0|py36hc3f5095_0|py37hc3f5095_1|py27hb1d0314_1|py27hb1d0314_0|py36hc3f5095_0|py37hc3f5095_1|py27hb1d0314_1|py27hb1d0314_0|py27hb1d0314_0|py36hc3f5095_0|py36hc3f5095_0|py27hb1d0314_0|py36h5bb6eb2_3|py38h5bb6eb2_3|py37hc2deb75_0|py39h0829f74_0|py37h0829f74_0|py38h0829f74_0|py39hc2deb75_0|py38hc2deb75_0|py37hc2deb75_0|py38hc2deb75_0|py39hc2deb75_0|py38haf7ebc8_0|py39haf7ebc8_0|py37haf7ebc8_0|py39hbd0edd7_0|py36ha3acd2a_0|py37ha3acd2a_0|py38ha3acd2a_0|py36ha3acd2a_0|py37ha3acd2a_0|py38ha3acd2a_0|py39h5bb6eb2_3|py37h5bb6eb2_3|py39h2e04a8b_1|py38hc3f5095_0|py37hc3f5095_0|py37hc3f5095_0|py27hb1d0314_0|py36hc3f5095_0|py37hc3f5095_0|py36hc3f5095_0|py37hc3f5095_0|py36hc3f5095_0|py37hc3f5095_0|py36hc3f5095_1|py37hc3f5095_0|py36hc3f5095_1|py37hc3f5095_0|py37hc3f5095_0|py27hb1d0314_0|py27h2753ae9_0|py27h2753ae9_1|py36h8128ebf_0|py27h2753ae9_0|py27hfef472a_0|py36h4a99626_0|py36h8128ebf_4|py36hc3f5095_0|py37hc3f5095_0|py37h5c71026_3|py36h5c71026_2|py37h5c71026_1|py37h5c71026_0|py36h5c71026_0|py36h5c71026_0|py36h555522e_1|py35h555522e_1|py36hc3f5095_12|py27hb1d0314_12|py37h8128ebf_11|py37h8128ebf_10|py36h8128ebf_10|py35h8128ebf_10|py37h4a99626_9|py36h4a99626_9|py35h4a99626_8|py37h5c71026_8|py36h5c71026_8|py37h5c71026_7|py27h0bb1d87_7|py37h5c71026_7|py36h5c71026_7|py27h0bb1d87_6|py36h5c71026_6|py37h5c71026_6']
  - matplotlib -> pyparsing
  - matplotlib -> python-dateutil
  - matplotlib -> python[version='>=2.7,<2.8.0a0'] -> ca-certificates
  - matplotlib -> python[version='>=3.6,<3.7.0a0'] -> vs2015_runtime[version='>=14.0.25123,<15.0a0|>=14.0.25420|>=14.15.26706|>=14.27.29016|>=14.16.27012']
  - matplotlib -> python[version='>=3.9,<3.10.0a0'] -> openssl[version='>=1.1.1a,<1.1.2a|>=1.1.1b,<1.1.2a|>=1.1.1c,<1.1.2a|>=1.1.1d,<1.1.2a|>=1.1.1e,<1.1.2a|>=1.1.1f,<1.1.2a|>=1.1.1g,<1.1.2a|>=1.1.1h,<1.1.2a|>=1.1.1i,<1.1.2a|>=1.1.1j,<1.1.2a|>=1.1.1k,<1.1.2a|>=1.1.1l,<1.1.2a']
  - matplotlib -> python[version='>=3.9,<3.10.0a0'] -> pip
  - matplotlib -> python[version='>=3.9,<3.10.0a0'] -> sqlite[version='>=3.25.3,<4.0a0|>=3.26.0,<4.0a0|>=3.27.2,<4.0a0|>=3.28.0,<4.0a0|>=3.29.0,<4.0a0|>=3.30.1,<4.0a0|>=3.31.1,<4.0a0|>=3.33.0,<4.0a0|>=3.35.4,<4.0a0|>=3.36.0,<4.0a0|>=3.32.3,<4.0a0|>=3.30.0,<4.0a0|>=3.35.1,<4.0a0']
  - matplotlib -> python[version='>=3.9,<3.10.0a0'] -> tzdata
  - matplotlib -> pytz
  - matplotlib -> setuptools -> wincertstore[version='>=0.2']
  - matplotlib -> tornado -> certifi[version='>=2016.09|>=2016.9.26|>=2020.06.20']
  - matplotlib -> vc[version='14.*|>=14.1,<15.0a0|9.*']
  - matplotlib -> vs2015_runtime[version='>=14.16.27012,<15.0a0']
  - matplotlib -> zlib[version='>=1.2.11,<1.3.0a0']

【问题讨论】:

【参考方案1】: 创建单独的 conda 环境。 keras-tf 应该位于与您正在执行的 (base) 不同的环境中,但您可能希望从头开始创建它。 从头开始创建环境时,conda 会计算出正确的依赖关系,但如果从需求文件安装,则会强制使用特定版本。如果使用的 yml 文件不是来自 conda,则可能存在版本冲突。 具有特定版本的包越多,发生版本冲突的可能性就越大。 见conda: Creating an environment with commands和Anaconda Tensorflow Documentation 以下是我的工作 tensorflow conda 环境。
name: tf-gpu
channels:
  - defaults
  - conda-forge
dependencies:
  - _tflow_select=2.1.0=gpu
  - abseil-cpp=20210324.2=hd77b12b_0
  - absl-py=0.13.0=py39haa95532_0
  - aiohttp=3.8.1=py39h2bbff1b_0
  - aiosignal=1.2.0=pyhd3eb1b0_0
  - astor=0.8.1=py39haa95532_0
  - astunparse=1.6.3=py_0
  - async-timeout=4.0.1=pyhd3eb1b0_0
  - attrs=21.2.0=pyhd3eb1b0_0
  - backcall=0.2.0=pyhd3eb1b0_0
  - blas=1.0=mkl
  - blinker=1.4=py39haa95532_0
  - bottleneck=1.3.2=py39h7cc1a96_1
  - brotli=1.0.9=ha925a31_2
  - brotlipy=0.7.0=py39h2bbff1b_1003
  - ca-certificates=2021.10.26=haa95532_2
  - cached-property=1.5.2=py_0
  - cachetools=4.2.2=pyhd3eb1b0_0
  - certifi=2021.10.8=py39haa95532_0
  - cffi=1.15.0=py39h2bbff1b_0
  - chardet=4.0.0=py39haa95532_1003
  - charset-normalizer=2.0.4=pyhd3eb1b0_0
  - click=8.0.3=pyhd3eb1b0_0
  - colorama=0.4.4=pyhd3eb1b0_0
  - coverage=5.5=py39h2bbff1b_2
  - cryptography=3.4.8=py39h71e12ea_0
  - cudatoolkit=11.3.1=h59b6b97_2
  - cudnn=8.2.1=cuda11.3_0
  - cycler=0.11.0=pyhd3eb1b0_0
  - cython=0.29.24=py39h604cdb4_0
  - dataclasses=0.8=pyh6d0b6a4_7
  - debugpy=1.5.1=py39hd77b12b_0
  - decorator=5.1.0=pyhd3eb1b0_0
  - entrypoints=0.3=py39haa95532_0
  - flatbuffers=2.0.0=h6c2663c_0
  - fonttools=4.25.0=pyhd3eb1b0_0
  - freetype=2.10.4=hd328e21_0
  - frozenlist=1.2.0=py39h2bbff1b_0
  - gast=0.4.0=pyhd3eb1b0_0
  - giflib=5.2.1=h62dcd97_0
  - google-auth=1.33.0=pyhd3eb1b0_0
  - google-auth-oauthlib=0.4.1=py_2
  - google-pasta=0.2.0=pyhd3eb1b0_0
  - grpcio=1.42.0=py39hc60d5dd_0
  - h5py=3.6.0=py39h3de5c98_0
  - hdf5=1.10.6=h7ebc959_0
  - icc_rt=2019.0.0=h0cc432a_1
  - icu=68.1=h6c2663c_0
  - idna=3.3=pyhd3eb1b0_0
  - importlib-metadata=4.8.2=py39haa95532_0
  - intel-openmp=2021.4.0=haa95532_3556
  - ipykernel=6.4.1=py39haa95532_1
  - ipython=7.29.0=py39hd4e2768_0
  - ipython_genutils=0.2.0=pyhd3eb1b0_1
  - jedi=0.18.0=py39haa95532_1
  - jpeg=9d=h2bbff1b_0
  - jupyter_client=7.0.6=pyhd3eb1b0_0
  - jupyter_core=4.9.1=py39haa95532_0
  - keras=2.6.0=py39hd3eb1b0_0
  - keras-base=2.6.0=pyhd3eb1b0_0
  - keras-preprocessing=1.1.2=pyhd3eb1b0_0
  - kiwisolver=1.3.1=py39hd77b12b_0
  - libclang=11.1.0=default_h5c34c98_1
  - libcurl=7.80.0=h86230a5_0
  - libpng=1.6.37=h2a8f88b_0
  - libprotobuf=3.17.2=h23ce68f_1
  - libssh2=1.9.0=h7a1dbc1_1
  - libtiff=4.2.0=hd0e1b90_0
  - libwebp=1.2.0=h2bbff1b_0
  - lz4-c=1.9.3=h2bbff1b_1
  - markdown=3.3.4=py39haa95532_0
  - matplotlib=3.5.0=py39haa95532_0
  - matplotlib-base=3.5.0=py39h6214cd6_0
  - matplotlib-inline=0.1.2=pyhd3eb1b0_2
  - mkl=2021.4.0=haa95532_640
  - mkl-service=2.4.0=py39h2bbff1b_0
  - mkl_fft=1.3.1=py39h277e83a_0
  - mkl_random=1.2.2=py39hf11a4ad_0
  - multidict=5.1.0=py39h2bbff1b_2
  - munkres=1.1.4=py_0
  - nest-asyncio=1.5.1=pyhd3eb1b0_0
  - numexpr=2.7.3=py39hb80d3ca_1
  - numpy=1.21.2=py39hfca59bb_0
  - numpy-base=1.21.2=py39h0829f74_0
  - oauthlib=3.1.1=pyhd3eb1b0_0
  - olefile=0.46=pyhd3eb1b0_0
  - openssl=1.1.1l=h2bbff1b_0
  - opt_einsum=3.3.0=pyhd3eb1b0_1
  - packaging=21.3=pyhd3eb1b0_0
  - pandas=1.3.4=py39h6214cd6_0
  - parso=0.8.2=pyhd3eb1b0_0
  - pickleshare=0.7.5=pyhd3eb1b0_1003
  - pillow=8.4.0=py39hd45dc43_0
  - pip=21.2.4=py39haa95532_0
  - prompt-toolkit=3.0.20=pyhd3eb1b0_0
  - protobuf=3.17.2=py39hd77b12b_0
  - pyasn1=0.4.8=pyhd3eb1b0_0
  - pyasn1-modules=0.2.8=py_0
  - pycparser=2.21=pyhd3eb1b0_0
  - pygments=2.10.0=pyhd3eb1b0_0
  - pyjwt=2.1.0=py39haa95532_0
  - pyopenssl=21.0.0=pyhd3eb1b0_1
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pyqt=5.12.3=py39hcbf5309_8
  - pyqt-impl=5.12.3=py39h415ef7b_8
  - pyqt5-sip=4.19.18=py39h415ef7b_8
  - pyqtchart=5.12=py39h415ef7b_8
  - pyqtwebengine=5.12.1=py39h415ef7b_8
  - pyreadline=2.1=py39haa95532_1
  - pysocks=1.7.1=py39haa95532_0
  - python=3.9.7=h6244533_1
  - python-dateutil=2.8.2=pyhd3eb1b0_0
  - python-flatbuffers=1.12=pyhd3eb1b0_0
  - python_abi=3.9=2_cp39
  - pytz=2021.3=pyhd3eb1b0_0
  - pywin32=228=py39hbaba5e8_1
  - pyyaml=6.0=py39h2bbff1b_1
  - pyzmq=22.3.0=py39hd77b12b_2
  - qt=5.12.9=h5909a2a_4
  - requests=2.26.0=pyhd3eb1b0_0
  - requests-oauthlib=1.3.0=py_0
  - rsa=4.7.2=pyhd3eb1b0_1
  - scipy=1.7.1=py39hbe87c03_2
  - seaborn=0.11.2=pyhd3eb1b0_0
  - setuptools=58.0.4=py39haa95532_0
  - six=1.16.0=pyhd3eb1b0_0
  - snappy=1.1.8=h33f27b4_0
  - sqlite=3.36.0=h2bbff1b_0
  - tensorboard=2.6.0=py_1
  - tensorboard-data-server=0.6.0=py39haa95532_0
  - tensorboard-plugin-wit=1.6.0=py_0
  - tensorflow=2.6.0=gpu_py39he88c5ba_0
  - tensorflow-base=2.6.0=gpu_py39hb3da07e_0
  - tensorflow-estimator=2.6.0=pyh7b7c402_0
  - tensorflow-gpu=2.6.0=h17022bd_0
  - termcolor=1.1.0=py39haa95532_1
  - tk=8.6.11=h2bbff1b_0
  - tornado=6.1=py39h2bbff1b_0
  - traitlets=5.1.1=pyhd3eb1b0_0
  - typing-extensions=3.10.0.2=hd3eb1b0_0
  - typing_extensions=3.10.0.2=pyh06a4308_0
  - tzdata=2021e=hda174b7_0
  - urllib3=1.26.7=pyhd3eb1b0_0
  - vc=14.2=h21ff451_1
  - vs2015_runtime=14.27.29016=h5e58377_2
  - wcwidth=0.2.5=pyhd3eb1b0_0
  - werkzeug=2.0.2=pyhd3eb1b0_0
  - wheel=0.35.1=pyhd3eb1b0_0
  - win_inet_pton=1.1.0=py39haa95532_0
  - wincertstore=0.2=py39haa95532_2
  - wrapt=1.13.3=py39h2bbff1b_2
  - xz=5.2.5=h62dcd97_0
  - yaml=0.2.5=he774522_0
  - yarl=1.6.3=py39h2bbff1b_0
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.11=h62dcd97_4
  - zstd=1.4.9=h19a0ad4_0
prefix: C:\Users\...\anaconda3\envs\tf-gpu

【讨论】:

尽管按照您的建议从头开始设置 conda 环境,但我遇到了与 Kate 相同的问题。不知何故,将 matplotlib 添加到 tensorflow 2.6 和 Python 3.9 环境会产生很多冲突。

以上是关于conda install matplotlib 导致巨大的不兼容性列表的主要内容,如果未能解决你的问题,请参考以下文章

conda更新后,使用matplotlib时python内核崩溃

conda更新后,使用matplotlib时python内核崩溃

windows 安装 matplotlib,使用conda

如何在 Windows 上使用 conda 安装 matplotlib 而不安装 Qt?

无法通过 WSL 使用 conda 显示 matplotlib 的输出

安装Matplotlib