无法在带有Python 3.8的Conda env中安装matplotlib

时间:2020-01-13 20:11:01

标签: python matplotlib anaconda

我正在Ubuntu 18.04系统上为Python 3.8复制我的Python 3.7 Conda环境。我从一个简单的简·康达(Jane Conda)env开始,其唯一要求是python = 3.8。然后,我开始从3.7环境安装软件包。

大多数过程进行得很顺利,但是matplotlib失败了。 Conda搜索显示了3.8版本的matplotlib,但是conda install命令无法解析一组无冲突的软件包。 Numpy,ipython等都安装良好。在旋转了许多细小的东西之后,它抱怨:

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Package python conflicts for:
python=3.8
Package pip conflicts for:
python=3.8 -> pip
matplotlib -> python[version='>=3.7,<3.8.0a0'] -> pip
Package certifi conflicts for:
python=3.8 -> pip -> setuptools -> certifi[version='>=2016.09|>=2016.9.26']
Package wheel conflicts for:
python=3.8 -> pip -> wheel
matplotlib -> python[version='>=3.7,<3.8.0a0'] -> pip -> wheel
Package python-dateutil conflicts for:
matplotlib -> python-dateutil
Package ca-certificates conflicts for:
matplotlib -> setuptools -> ca-certificates
python=3.8 -> openssl[version='>=1.1.1d,<1.1.2a'] -> ca-certificates
Package setuptools conflicts for:
python=3.8 -> pip -> setuptools
matplotlib -> setuptools

我不太清楚这是什么意思。可能是matplotlib本身的版本依赖性不正确,或者没有适用于Python> = 3.8.0a0的官方matplotlib Conda软件包?康达搜索提示应该有一些东西:

% conda search matplotlib
...
matplotlib                     3.1.1  py38h5429711_0  pkgs/main

以下是conda信息的输出:

     active environment : python38
    active env location : /home/skip/miniconda3/envs/python38
            shell level : 2
       user config file : /home/skip/.condarc
 populated config files : /home/skip/.condarc
          conda version : 4.8.1
    conda-build version : not installed
         python version : 3.7.3.final.0
       virtual packages : __glibc=2.27
       base environment : /home/skip/miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/skip/miniconda3/pkgs
                          /home/skip/.conda/pkgs
       envs directories : /home/skip/miniconda3/envs
                          /home/skip/.conda/envs
               platform : linux-64
             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
                UID:GID : 1000:1000
             netrc file : /home/skip/.netrc
           offline mode : False

不确定为什么将3.7.3报告为Python版本。也许那是在根环境中?我显然已经安装了3.8.1:

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

2 个答案:

答案 0 :(得分:4)

到目前为止,到2020年3月,您必须不幸地降级您的conda可执行文件(在您的基本环境中)以安装matplotlib。这是github discussion

尝试一下:

conda activate
conda config --set allow_conda_downgrades true
conda install conda==4.6.14

conda create --name test_env
conda activate test_env
conda install matplotlib

这应该有效。

答案 1 :(得分:0)

conda install -c conda-forge matplotlib

它对我有用。我的环境是python 3.8和Ubuntu 18.04。