无法在Conda env w/ Python 3.8中安装matplotlib

tv6aics1  于 2023-10-24  发布在  Python
关注(0)|答案(3)|浏览(161)

我正在Ubuntu 18.04系统上复制Python 3.8的Python 3.7 Conda环境。我从一个简单的jane Conda env开始,python=3.8作为唯一的要求。然后我开始从我的3.7环境安装软件包。
大多数过程都很顺利,但matplotlib失败了。Conda搜索显示matplotlib的3.8版本,但conda install命令无法解决一组不冲突的软件包。Numpy,ipython等都安装得很好。在多次旋转后,它抱怨说:

  1. UnsatisfiableError: The following specifications were found to be incompatible with each other:
  2. Package python conflicts for:
  3. python=3.8
  4. Package pip conflicts for:
  5. python=3.8 -> pip
  6. matplotlib -> python[version='>=3.7,<3.8.0a0'] -> pip
  7. Package certifi conflicts for:
  8. python=3.8 -> pip -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']
  9. Package wheel conflicts for:
  10. python=3.8 -> pip -> wheel
  11. matplotlib -> python[version='>=3.7,<3.8.0a0'] -> pip -> wheel
  12. Package python-dateutil conflicts for:
  13. matplotlib -> python-dateutil
  14. Package ca-certificates conflicts for:
  15. matplotlib -> setuptools -> ca-certificates
  16. python=3.8 -> openssl[version='>=1.1.1d,<1.1.2a'] -> ca-certificates
  17. Package setuptools conflicts for:
  18. python=3.8 -> pip -> setuptools
  19. matplotlib -> setuptools

我不太清楚这是什么意思。也许是matplotlib本身的版本依赖不正确,或者Python >= 3.8.0a0没有官方的matplotlib Conda包?Conda搜索表明应该有一些东西:

  1. % conda search matplotlib
  2. ...
  3. matplotlib 3.1.1 py38h5429711_0 pkgs/main

下面是conda info的输出:

  1. active environment : python38
  2. active env location : /home/skip/miniconda3/envs/python38
  3. shell level : 2
  4. user config file : /home/skip/.condarc
  5. populated config files : /home/skip/.condarc
  6. conda version : 4.8.1
  7. conda-build version : not installed
  8. python version : 3.7.3.final.0
  9. virtual packages : __glibc=2.27
  10. base environment : /home/skip/miniconda3 (writable)
  11. channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
  12. https://repo.anaconda.com/pkgs/main/noarch
  13. https://repo.anaconda.com/pkgs/r/linux-64
  14. https://repo.anaconda.com/pkgs/r/noarch
  15. package cache : /home/skip/miniconda3/pkgs
  16. /home/skip/.conda/pkgs
  17. envs directories : /home/skip/miniconda3/envs
  18. /home/skip/.conda/envs
  19. platform : linux-64
  20. user-agent : conda/4.8.1 requests/2.22.0 CPython/3.7.3 Linux/4.15.0-74-generic ubuntu/18.04.3 glibc/2.27
  21. UID:GID : 1000:1000
  22. netrc file : /home/skip/.netrc
  23. offline mode : False

不知道为什么它报告3.7.3作为Python版本。也许这是在根环境中?我显然安装了3.8.1:

  1. (python38) polly% python
  2. Python 3.8.1 (default, Jan 8 2020, 22:29:32)
  3. [GCC 7.3.0] :: Anaconda, Inc. on linux
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>>
vltsax25

vltsax251#

  1. conda install -c conda-forge matplotlib

我的环境是python 3.8和Ubuntu 18.04。

anauzrmj

anauzrmj2#

从现在开始,2020年3月,你必须不幸地降级你的conda可执行文件(在你的基础环境中)才能安装matplotlib。下面是github的讨论。
试试这个:

  1. conda activate
  2. conda config --set allow_conda_downgrades true
  3. conda install conda==4.6.14
  4. conda create --name test_env
  5. conda activate test_env
  6. conda install matplotlib

这个应该能用

4szc88ey

4szc88ey3#

我知道不建议混合使用pipconda,但运行
pip install matplotlib
在经历了这么多等待和未解决的冲突后,我终于成功了。

相关问题