I am trying to use the the matplotlib library for a python program I am writing for the development board.
I created a custom image which includes python and python-matplotlib.
When I try to import I get the following error:
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 31, in <module>
import matplotlib.colorbar
File "/usr/lib/python2.7/site-packages/matplotlib/colorbar.py", line 32, in <module>
import matplotlib.artist as martist
File "/usr/lib/python2.7/site-packages/matplotlib/artist.py", line 16, in <module>
from .path import Path
File "/usr/lib/python2.7/site-packages/matplotlib/path.py", line 21, in <module>
from . import _path, rcParams
ImportError: cannot import name _path
I noticed that _path,so is missing from: /usr/lib/python2.7/site-packages/matplotlib/ which is why its not found.
This led me to look into the patch that is applied when installing matplotlib where setupext.Path() is explicitly removed:
@@ -66,28 +66,6 @@ mpl_packages = [
setupext.Python(),
setupext.Platform(),
'Required dependencies and extensions',
- setupext.Numpy(),
- setupext.Six(),
- setupext.Dateutil(),
- setupext.FuncTools32(),
- setupext.Subprocess32(),
- setupext.Pytz(),
- setupext.Cycler(),
- setupext.Tornado(),
- setupext.Pyparsing(),
- setupext.LibAgg(),
- setupext.FreeType(),
- setupext.FT2Font(),
- setupext.Png(),
- setupext.Qhull(),
- setupext.Image(),
- setupext.TTConv(),
- setupext.Path(),
- setupext.ContourLegacy(),
- setupext.Contour(),
- setupext.Delaunay(),
- setupext.QhullWrap(),
- setupext.Tri(),
'Optional subpackages',
setupext.SampleData(),
setupext.Toolkits(),
@@ -100,13 +78,8 @@ mpl_packages = [
setupext.BackendMacOSX(),
setupext.BackendQt5(),
setupext.BackendQt4(),
- setupext.BackendGtk3Agg(),
setupext.BackendGtk3Cairo(),
- setupext.BackendGtkAgg(),
- setupext.BackendTkAgg(),
- setupext.BackendWxAgg(),
setupext.BackendGtk(),
- setupext.BackendAgg(),
setupext.BackendCairo(),
setupext.Windowing(),
'Optional LaTeX dependencies',
I tried to install matplotlib without applying this patch and I get the following error:
| exec(code, globals, locals)
| File "/tmp/easy_install-7x6315zy/numpy-1.20.1/setup.py", line 30, in <module>
| from setuptools.command import sdist
| RuntimeError: Python version >= 3.7 required.
| ERROR: python3 setup.py build_ext execution failed.
It seems like that in order for the removed packages to compile numpy is needed. And in order to install numpy python version 3.7 or greater is needed.
The current bitbake file for python3 is python3_3.5.3.bb. Is there an updated bitbake file > 3.7 which can be used? Or do you have another work around for installing matplotlib with numpy and all the required accelerated modules ?