Steve
Steve

Reputation: 4668

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

I am receiving the following error message

ImportError: cannot import name 'style'

when I run

from matplotlib import style

I am using ubuntu and have tried running it with python3 and python. I have version (1.3.1) of matplotlib installed, which is the most up-to-date that apt-get installs. I have installed numpy and installed matplotlib with python3. No joy.

Has anybody else been having the same issue ?

Upvotes: 11

Views: 15172

Answers (3)

SenatorWaffles
SenatorWaffles

Reputation: 380

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

Using sudo is deemed unsafe as you're allowing pip to execute code from the internet as root.

Using --user :

..makes pip install packages in your home directory instead, which doesn't require any special privileges Purpose of --user

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

Upvotes: 2

Fabrizio
Fabrizio

Reputation: 11

I had the same problem using Anaconda and IPython 3.1. You can update matplotlib to its latest version after you have installed Anaconda. Just remind that you may want to use the installer for Python 3. You will find the style module by using both the matplotlib library and matplotlib.pyplot.

Upvotes: 1

Steve
Steve

Reputation: 4668

sudo pip install --upgrade matplotlib

Did the trick. Although on my machine it initially threw up some issues. There are a number of helpful suggestions on this thread for anyone else having the issue

ubuntu 14.04, pip cannot upgrade matplotllib

Upvotes: 7

Related Questions