If I try to import seaborn in my script I get this error:
/usr/local/lib/python2.7/dist-packages/IPython/html.py:14: ShimWarning:
The `IPython.html` package has been deprecated. You should import from
`notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
"`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)
I installed seaborn from pip at the last version 0.7.1 on Ubuntu 16.04 64 bit.
Anyone has ideas?
seaborn is working but this warning is very annoying.
There is an issue in the seaborn project explaining the reasons and solutions for this problem: https://github.com/mwaskom/seaborn/issues/874
Basically it says:
pip install ipywidgets
It is not an Error, it's a Warning.
To avoid Warnings from showing up you can put before importing seaborn:
import warnings
warnings.filterwarnings('ignore')
Warnings of all types won't show up anymore
Related
I recently updated matplotlib and now I am consistently getting an error when I write from matplotlib import pyplot as plt.
ImportError: cannot import name 'artist' from 'matplotlib' (C:\Users\nenze\AppData\Roaming\Python\Python39\site-packages\matplotlib\__init__.py)
I've tried uninstalling and reinstalling matplotlib which didn't solve anything. I even tried to downgrade to an older version but I am still getting the same error.
This is with matplotlib version 3.5.1. This is with Python version 3.9.7. This is through Jupyter Notebooks.
Ended up deleting Python\Python39\site-packages\matplotlib_init_.py and it worked itself out.
I also deleted files that started with ~ (ex: ~matplotlib).
I am trying to import plotly.express but I get the follow error:
AttributeError: module plotly.colors has no attribute named_colorscales
Code to import:
import plotly.graph_objects as go
import pandas as pd
import plotly.express as px
fig=go.Figure()
I have installed plotly express this morning using:
conda install -c plotly plotly_express
It appears to have been successfully installed without errors, but when I import it, the above error appears.
Kernel was restarted post installation.
EDIT: I have amended the code slightly as there was a slight error and an redundant import.
After a lot of work, it looks like the version of Plotly that I was using was out of date. I have upgraded that and it appears to have worked. Out of desperation, I decided to try upgrade plotly.express and it was out of date. After upgrade, worked like a charm.
I am trying to set a style in matplotlib as per tutorial http://matplotlib.org/users/style_sheets.html
import matplotlib.pyplot as plt
plt.style.use('ggplot')
but what I get in return is:
AttributeError: 'module' object has no attribute 'style'
My matplotlib version is 1.1.1 (and I'm on a Mac running Mavericks). Where are the styles in this version?
thanks!
My matplotlib version is 1.1.1
There's your problem. The style package was added in version 1.4. You should update your version.
In ipython notebook I also had to include %matplotlib inline, otherwise I would still get the same error.
%matplotlib inline
import matplotlib
matplotlib.style.use('ggplot')
For people using matplotlib 2.x and discovering this question can use the following snippet:
import matplotlib.style
import matplotlib as mpl
mpl.style.use('classic') # any style.
This is described in the documentation here. Note the import matplotlib.style is important.
I tried all solutions listed on StackOverflow but somehow none of these work for me. Finally I found a method which worked. Following are the details:
Environment:
OS : Ubuntu 16
Python Version : 3.5.
MatPlotLib Version : 2.0.2
Correct Way of importing 'style module'
import matplotlib
matplotlib.use
import matplotlib.pyplot as plt
plt.style.use('ggplot')
The matplotlib help reads:
:func:~matplotlib.use (ignore syntax as "`" did not work either on command line or script file)
a function for setting the matplotlib backend. If used, this
function must be called immediately after importing matplotlib
for the first time. In particular, it must be called
before importing pylab (if pylab is imported).
Somehow without issuing this command, it was not possible to access the 'Style' module.
Hope this helps.
For MatPlotLib version 3.6.3 and above, the following code to be used to use "seaborn" style as the seaborn has been deprecated since version 3.6:
import matplotlib
matplotlib.use
import matplotlib.pyplot as plt
plt.style.use("seaborn-v0_8")
I seem to have a problem that is in parts very similar to the one mentioned here:
Python with eclipse import problem
But unfortunatly just in parts otherwise that would have solved mine as well.
I use Eclipse SDK, Version: 3.7.0 with PyDev 101.
Furthermore I have installed
numpy-1.6.1rc1-win32-superpack-python2.6.exe
and
matplotlib-1.0.1.win32-py2.6.exe
as noted here:
http://matplotlib.sourceforge.net/users/installing.html
I have rebuild all the packages and looks the site-packages are listed.
(by the way as you see it is an Python version installed with ArcGIS )
If I test a script for instance a very simple one like:
import numpy
import matplotlib
import pylab as pl
I get the following error in Eclipse:
import matplotlib
import pylab as pl
from matplotlib.pylab import *
ImportError: No module named pylab
Even though the interpreter for Pydev is pointing to the appropriate version of python and matplotlib is installed properly in there (site-packages) it does not work in Eclipse. In iPython it works perfect.
What still needs to be done to get matplotlib work in Eclipse?
Thanks a lot!
Werner
pylab is in matplotlibs namespace, so this should work:
import matplotlib.pylab as pylab
I found that turning off interactive move and then calling show worked.
import matplotlib.pyplot as plt
#...your code...
plt.ioff()
plt.show()
When i try to run a python script in which i do an import statement matplotlib.patheffects, i get an error message saying there is no module called patheffects.
the statement is
import matplotlib.patheffects
Kindly help me to figure out the reason for this error and how to make the code run without this glitch.
import matplotlib.patheffects works perfectly well for me. Please make sure you have matplotlib installed. The most current version is 1.0.1. You can download from here.
Matplotlib depends on numpy, so make sure you have it installed before installing matplotlib.
Also check out the tips on installing matplotlib.