Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install matplotlib in Conda env w/ Python 3.8

I'm replicating my Python 3.7 Conda environment for Python 3.8 on an Ubuntu 18.04 system. I started with a plain jane Conda env with python=3.8 as the sole requirement. Then I started installing packages from my 3.7 environment.

Most of the process went swimmingly, but matplotlib failed. Conda search shows a 3.8 version of matplotlib, but the conda install command is unable to resolve a nonconflicting set of packages. Numpy, ipython, etc all installed fine. After much spinning of the little spinny thing it complains:

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

I can't quite tell what it means. Maybe the version dependency for matplotlib itself is incorrect, or there's no official matplotlib Conda package for Python >= 3.8.0a0? Conda search suggests there should be something:

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

Here's the output of conda info:

     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

Not sure why it reports 3.7.3 as the Python version. Perhaps that's in the root environment? I clearly have 3.8.1 installed:

(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.
>>> 
like image 914
smontanaro Avatar asked Jan 13 '20 20:01

smontanaro


People also ask

Does Python 3.8 support matplotlib?

matplotlib has released the suitable version for python 3.8.

Does Python 3.7 support matplotlib?

Matplotlib is a python library that allows you to represent your data visually. It's particularly useful for data science and machine learning developers. Matplotlib is the most visualization package for Python.

Does conda include matplotlib?

Conda packages include Python libraries (NumPy or matplotlib ), C libraries ( libjpeg ), and executables (like C compilers, and even the Python interpreter itself).

Is it possible to install Matplotlib in conda?

As of now, March 2020, you must unfortunately downgrade your conda executable (in your base environment) to install matplotlib. Here's the github discussion. This should work.

What is Matplotlib in Windows?

win-64 v3.5.0 matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in Python scripts, the Python and IPython shell (ala MATLAB or Mathematica), web application servers, and six graphical user interface toolkits.

What version of python do I need to run Matplotlib?

The current version of matplotlib requires Python >= 3.6, so this might be part of your challenge. But I think the first error is where the issue lays - it looks like you're missing your needed 3rd party dependencies.

Is it possible to install NumPy on a Mac OS X Catalina?

I currently have Python 2.7 and Python 3.8 (downloaded the .dmg via Python.org) on my Mac OS X Catalina. I have successfully installed Numpy via Terminal, as well as Matplotlib on Python 2.7 via Terminal, but I always get two error codes when I install Matplotlib through Terminal.


2 Answers

conda install -c conda-forge matplotlib

It worked for me. My environment is python 3.8 and Ubuntu 18.04.

like image 173
Sparks Avatar answered Oct 07 '22 12:10

Sparks


As of now, March 2020, you must unfortunately downgrade your conda executable (in your base environment) to install matplotlib. Here's the github discussion.

Try this:

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

This should work.

like image 22
Agile Bean Avatar answered Oct 07 '22 10:10

Agile Bean