Search code examples
python-3.xmatplotlibwxpython

Missing wxversion when using matplotlib with wxPython/Phoenix in Python3


I want to use matplotlib with wxPython (more concret: wxPhoenix) in Python3. But the code below doesn't work because of missing wxversion.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import wx
import matplotlib
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg

There is no Ubuntu-package python3-wxversion, no pip3-package. btw: With Python2 I can import wxversion. I used the matplotlib from Ubuntu-Repository (1.3.1) and the upgraded one with pip3.

How can I install wxversion for Python3 and why is that missing?

I am using wxPython-Phoenix (3.0.3.dev1820+49a8884).


Solution

  • There were many other issues with mpl and wxPython Phoenix, there is a PR https://github.com/matplotlib/matplotlib/pull/3421 which was merged in May, but I am not sure if there has been a release of mpl since then. I think it is in 1.5dev1, but not sure, please check with the mpl devs.