From matplotlib import style ImportError: cannot import name 'style'

I get the following error message

ImportError: cannot import name 'style' 

when i run

 from matplotlib import style 

I am using ubuntu and trying to run it using python3 and python. I have installed version (1.3.1) of matplotlib, which is the latest version installed by apt-get . I installed numpy and installed matplotlib with python3. There is no joy.

Has anyone else had the same problem?

+6
source share
3 answers

sudo pip install --upgrade matplotlib

Did the trick. Although my car initially had some problems. This topic has some helpful tips for anyone who has a problem.

ubuntu 14.04, pip cannot update matplotllib

+5
source

You can also use pip install --user --upgrade matplotlib

Using sudo is considered unsafe because you allow pip to execute code from the Internet as root.

Using --user:

.. instead installs install packages in your home directory, which does not require special privileges. The goal is user

More on this here: What are the risks of running 'sudo pip'?

+1
source

I had the same issue using Anaconda and IPython 3.1. You can upgrade matplotlib to the latest version after you install Anaconda. Just be reminded that you can use the installer for Python 3. You will find the style module using the matplotlib library and matplotlib.pyplot .

0
source

All Articles