Have installed matplotlib 3 times still get error: ImportError: No module named backends.backend_wxagg

have completely installed and re installed matplotlib 3 times 3 different ways if i open idle it will let me add import matplotlib but as soon as i try to run sample code from the matplotlib website i get errors, always when using the convention:

from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.path import Path
from matplotlib.spines import Spine
from matplotlib.projections.polar import PolarAxes
from matplotlib.projections import register_projection

the from statement can be anything the only hting that follows is an errors saying

ImportError: No module named backends.backend_wxagg

Anon@TBCC-DELL-Mobile1:/home/tjohnson/python# python matplotlib.py
Traceback (most recent call last):
  File "matplotlib.py", line 16, in <module>
    from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
  File "/home/tjohnson/python/matplotlib.py", line 16, in <module>
    from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
ImportError: No module named backends.backend_wxagg

Anon@TBCC-DELL-Mobile1:/home/tjohnson/python# python radar_chart.py
Traceback (most recent call last):
  File "radar_chart.py", line 14, in <module>
    import matplotlib.pyplot as plt
  File "/home/tjohnson/python/matplotlib.py", line 16, in <module>
    from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
ImportError: No module named backends.backend_wxagg

have tried with several different versions of matplotlib and still same result. suggestions?


It sounds like there is a conflict related to the system python installation. Perhaps the system python does not see the matplotlib installation. You may also want to check the permissions of the installed files. What operating system are you running and what method are you using for installing matplotlib (pip, apt-get, setup.py, building binaries)?

Try opening a python shell and simply importing matplotlib:

>>> import matplotlib as mpl

python, In my code, I need to check whether the matplotlib backend has import matplotlib if not matplotlib.get_backend() == 'WXAgg': With matplotlib 2.2.3: matplotlib 3.0.0 has backend issues only when installed by conda #10219 In that specific case you'll get an ImportError, which is just fine with me. pip uninstall matplotlib pip install matplotlib --no-binary=matplotlib This will solve your problem, provided that you already installed gtk2 with sudo apt-get install python-gtk2-dev As you want to use the GTKAgg backend, Using pip may prove useful in the future to freeze matplotlib at a version where it is supported (the deprecation warning states it will be dropped in 3.0):


I had the same problem. First I checked out the import sys sys.path to see what are the folders that it searches for the installed packages.

my result was something like this.

['', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\python36.zip', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\DLLs', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36', 'C:\\Users\\gsotiropoulos\\AppData\\Roaming\\Python\\Python36\\site-packages', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\win32', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\win32\\lib', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\Pythonwin', 'C:\\Users\\gsotiropoulos\\AppData\\Local\\conda\\conda\\envs\\py36\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\gsotiropoulos\\.ipython']

then as suggested I import matplotlib as mpl and mpl.__path__ seeing that I import matplotlib from the folder 'C:\\Users\\gsotiropoulos\\AppData\\Roaming\\Python\\Python36\\site-packages' Which is not the one from anaconda and it is older. I am not sure if it would be better to just remove this folder completely.

However, as I understand, python first searched there and found a matplotlib package which was outdated. I simply changed the name of the `matplotlib' to something like 'matplotlib_test' and then the library is installed from one of the anaconda folders and the problem is solved.

I wonder if I should delete the "roaming" folder to avoid similar other problems.

In 3.0.0 backend cannot be set if 'get_backend()' is run first · Issue , Please verify that you have installed matplotlib for python 3.x as a user This is the output of the commands , I ran the training again and it had the same error: ImportError: No module named 'matplotlib' To find out more about why /usr/lib/​python3/dist-packages/matplotlib/backends/backend_wxagg.py See the backend FAQ at the matplotlib web site. ImportError: No module named _backend_gdk. For the second error, maybe your matplotlib distribution is not compiled with GTK support, or you miss the PyGTK package. Try to install it. Do you call the show() method inside a terminal or application that has access to a graphical environment?


This backend has been removed from matplotlib. I don't know of a workaround.

No module named matplotlib · Issue #3703 · tensorflow/models , If not, the best way to test your install is by running a script, rather than working This will give you additional information about which backends Matplotlib is If you are still having trouble, see Getting help. Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named matplotlib Upstream changed the default backend (checking 1.2 and 1.3 diffs): -backend : GTKAgg +backend : qt4agg It could be patched to revert to use GTKAgg (or plain Agg) or make a requires to python-matplotlib-qt4 in the main package.


Installation, If you want to install Matplotlib for Python 3 through the APT package manager, you need the package python3-matplotlib : sudo apt-get install  htgoebel changed the title ImportError: No module named 'PySide' Need hooks for matplotlib.backends to exclude unwanted backends Sep 15, 2017 This comment has been minimized. Sign in to view


matplotlib Error: No module named matplotlib even though it is , The matlab > interface could add this method at module load time so as to not If X is not present, they get the runtime error, and in this case GTK will still build, right? from _gtkagg import agg_to_gtk_drawable ImportError: No module named lib/python2.3/site-packages/matplotlib/backends/backend_wxagg.py", line 18,  I ran $ sudo pip install imutils then $ python python 3.5.2. import imutils ImportError: No module names 'imutils' if run $ sudo python Python 2.7.12. import imutils (imports ok) I had installed imutils in Python2.7 (sudo pip install imutils) and was trying to use it in Python3 (thinking I was in Python2 - PEBKAC)


matplotlib / List matplotlib-users Archives, I can't seem to create a usable Py3 tool chain. getting wxPython_Phoenix-3.0.2​.dev78075-cp34-none-win_amd64.whl Installing collected packages: wxPython-Phoenix NameError: name 'wx' is not defined from matplotlib.​backends.backend_wxagg import FigureCanvasWxAgg as FigCanvas. The errors you posted are unrelated. The first one is due to you selecting a backend that is not meant for interactive use, i.e. agg. You can still use (and should use) those for the generation of plots in scripts that don’t require user interaction.