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 ?
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
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'?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With