kivy-garden/garden.matplotlib

Problem whit from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg on windows

juanjpnv opened this issue · 3 comments

When I import the garden.matplotlib package i recive a error mensage:
ImportError: cannot import name 'weight_as_number' from 'matplotlib.font_manager'

I used the Python in the Command Prompt to import step-by-step. I find a error in the garden.matplotlib import line.

System: Windows 10, Python 3.7.0, Kivy 1.10.1

>>> import matplotlib
Backend TkAgg is interactive backend. Turning interactive mode on.

>>> matplotlib.use('module://kivy.garden.matplotlib.backend_kivy')

>>>from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
[INFO ] [Logger ] Record log in C:\Users\user.kivy\logs\kivy_18-10-03_7.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 20, in do_import
module = self.system_import(name, *args, **kwargs)
File "D:\Documents\venv\lib\site-packages\kivy\garden_init
.py", line 100, in load_module
return self.load_module(fullname, moddir)
File "D:\Documents\venv\lib\site-packages\kivy\garden_init
.py", line 104, in _load_module
('', '', imp.PKG_DIRECTORY))
File "C:\Python37-32\lib\imp.py", line 245, in load_module
return load_package(name, filename)
File "C:\Python37-32\lib\imp.py", line 217, in load_package
return load(spec)
File "C:\Users\user.kivy\garden\garden.matplotlib_init
.py", line 1, in
from kivy.garden.matplotlib.backend_kivy import FigureCanvasKivy,
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 20, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\user.kivy\garden\garden.matplotlib\backend_kivy.py", line 257, in
from matplotlib.font_manager import weight_as_number
ImportError: cannot import name 'weight_as_number' from 'matplotlib.font_manager' (D:\Documents\venv\lib\site-packages\matplotlib\font_manager.py)

Hi, I had the same issue. This is due to incompatibility with matplotlib 3.0.0+ .

I've created a fork that fixes the issue and requested a pull.

In the meantime you can either get the new source here: https://github.com/xstreck1/garden.matplotlib or downgrade matplotlib to 2.2.2 .

Fixed by #62.

I downgrade matplotlib to 2.2.2 and it's solved.
Thanks