Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 699966 - dev-python/matplotlib-2.2.4 fails with python-3.7: ImportError: /usr/lib/python3.7/site-packages/matplotlib/_path.cpython-37m-x86_64-linux-gnu.so: undefined symbol: MPL_matplotlib_backends__backend_agg_ARRAY_API
Summary: dev-python/matplotlib-2.2.4 fails with python-3.7: ImportError: /usr/lib/pyth...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 3 votes (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
: 721644 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-11-12 23:15 UTC by edes
Modified: 2021-12-04 21:00 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description edes 2019-11-12 23:15:19 UTC
in my system, matplotlib works fine with python 3.6, but fails with python 3.7:

Python 3.7.5 (default, Nov 11 2019, 22:01:35) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/matplotlib/pyplot.py", line 31, in <module>
    import matplotlib.colorbar
  File "/usr/lib/python3.7/site-packages/matplotlib/colorbar.py", line 32, in <module>
    import matplotlib.artist as martist
  File "/usr/lib/python3.7/site-packages/matplotlib/artist.py", line 16, in <module>
    from .path import Path
  File "/usr/lib/python3.7/site-packages/matplotlib/path.py", line 21, in <module>
    from . import _path, rcParams
ImportError: /usr/lib/python3.7/site-packages/matplotlib/_path.cpython-37m-x86_64-linux-gnu.so: undefined symbol: MPL_matplotlib_backends__backend_agg_ARRAY_API
>>> 



Reproducible: Always
Comment 1 Jarek Rymut 2019-12-28 10:09:20 UTC
It did not happen before. But recently I had some dependecy issues, I rebuilt some packages, matplotlib included. And I had exactly the same error with python 3.7.6.
Building matplotlib with MAKEOPTS="-j1 -l0" produces working library.
Comment 2 Ștefan Talpalaru 2019-12-29 18:02:27 UTC
Fixed by dev-python/matplotlib-2.2.4-r100 from my overlay: https://github.com/stefantalpalaru/gentoo-overlay

It boils down to "py_converters.o" being shared by different extensions while needing a different "-DPY_ARRAY_UNIQUE_SYMBOL=..." value for each of them.

Fixing it for Python3 was trivial - just disable parallel building, as already mentioned here.

The Python2 fix was anything but trivial, after hunting a bunch of ridiculous monkey-patching between distutils, setuptools, Cython's own distutils variant (if installed) and matplotlib's own setup.py. That object file was compiled only once, then linked in 4 different extensions. The solution was even more overriding in order to delete all object files between extension builds.

Language-specific build systems are an abomination...
Comment 3 Benda Xu gentoo-dev 2020-01-26 02:07:16 UTC
Now we have matplotlib-3.1.2 in tree, can this bug be reproduced?
Comment 4 segmentation fault 2020-05-02 14:38:17 UTC
(In reply to Benda Xu from comment #3)
> Now we have matplotlib-3.1.2 in tree, can this bug be reproduced?

There are situations where this kind of argument is totally unproductive.

For example, if I want to install Sage (from the sage-on-gentoo overlay), I am restricted by a '<dev-python/matplotlib-3' constraint. Then having a 3.x version does not help me - I must go past the errors of the 2.x branch.

Just because there is a new version does not imply that all packages that rely on this one will upgrade to it immediately - it may take even years.

Please concentrate on productive arguments.
Comment 5 Pacho Ramos gentoo-dev 2020-05-02 15:12:39 UTC
In other distributions they allow sage to be compiled with newer matplotlib-3 with patches like:
https://git.archlinux.org/svntogit/community.git/tree/trunk/sagemath-matplotlib-3.2.patch?h=packages/sagemath

I have also seen similar in Debian and Fedora... maybe you could report to the author of the overlay :/
Comment 6 François Bissey 2020-05-02 20:42:53 UTC
Yes, sage-9.0 is a bit of a pickle and I intend to retire it the minute 9.1 is out. Technically I could backport a number of fixes to move to newer matplotlib/sphinx and what not. But I almost would prefer people to just go for sage-9999 which is technically 9.1rc2 at the time of writing.

May be that's what I should do. Create a 9.1.rc2 ebuild so people don't feel they are on the edge and have something productive which doesn't drag python2 compatibility kludge.
Comment 7 segmentation fault 2020-05-03 11:19:00 UTC
Hello François,

nice to see you here. Yes, you are right, me too is just waiting for the 9.1 release and I am reluctant to use something with a '9999' tag on it. It's just human psychology, you know - we don't trust the unfamiliar. '9.1-preRC125.2.1b' is so much more reassuring than the hackish/binary/hex-looking version '9999'. :-)
Comment 8 François Bissey 2020-05-04 02:26:25 UTC
Well, the default sage version in the overlay is now 9.1_rc2. I'll remove 9.0 and all its crumbs in a couple of days. Use the usual channels to report issues with the release.
At least, I am not holding anyone onto matplotlib-2 anymore.
Comment 9 mercuriete 2020-05-08 01:20:05 UTC
I can confirm the problem and I could install it with this command

sudo MAKEOPTS="-j1" emerge --oneshot --ask  --ignore-default-opts --jobs=1 matplotlib

It is a similar problem than:
https://bugs.gentoo.org/676640
Comment 10 Erik Quaeghebeur 2020-05-09 08:44:07 UTC
*** Bug 721644 has been marked as a duplicate of this bug. ***
Comment 11 Erik Quaeghebeur 2020-05-09 08:53:51 UTC
This bug should be set as confirmed…
Comment 12 Venkat Nagappan 2020-05-15 14:33:06 UTC
I am experiencing this too when launching pitivi.

dev-python/matplotlib-2.2.2-r1
media-video/pitivi-0.999-r3


❯ pitivi
Traceback (most recent call last):
  File "/usr/bin/pitivi", line 168, in <module>
    _run_pitivi()
  File "/usr/bin/pitivi", line 145, in _run_pitivi
    from pitivi import application
  File "/usr/lib64/pitivi/python/pitivi/application.py", line 34, in <module>
    from pitivi.mainwindow import MainWindow
  File "/usr/lib64/pitivi/python/pitivi/mainwindow.py", line 47, in <module>
    from pitivi.timeline.timeline import TimelineContainer
  File "/usr/lib64/pitivi/python/pitivi/timeline/timeline.py", line 35, in <module>
    from pitivi.timeline.elements import Clip
  File "/usr/lib64/pitivi/python/pitivi/timeline/elements.py", line 31, in <module>
    from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas
  File "/usr/lib/python3.7/site-packages/matplotlib/backends/backend_gtk3cairo.py", line 6, in <module>
    from . import backend_cairo, backend_gtk3
  File "/usr/lib/python3.7/site-packages/matplotlib/backends/backend_cairo.py", line 41, in <module>
    from matplotlib.backend_bases import (
  File "/usr/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 53, in <module>
    from matplotlib import (
  File "/usr/lib/python3.7/site-packages/matplotlib/textpath.py", line 15, in <module>
    from matplotlib.path import Path
  File "/usr/lib/python3.7/site-packages/matplotlib/path.py", line 21, in <module>
    from . import _path, rcParams
ImportError: /usr/lib/python3.7/site-packages/matplotlib/_path.cpython-37m-x86_64-linux-gnu.so: undefined symbol: MPL_matplotlib_backends__backend_agg_ARRAY_API
Comment 13 cjosephson 2020-05-18 22:07:36 UTC
I am also experiencing this with matplotlib-2.2.-r1 and python 3.7.7. When I try to run a script that imports matplotlib, I get this error:

Traceback (most recent call last):
  File "./twobat_plot.py", line 7, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib/python3.7/site-packages/matplotlib/pyplot.py", line 31, in <module>
    import matplotlib.colorbar
  File "/usr/lib/python3.7/site-packages/matplotlib/colorbar.py", line 32, in <module>
    import matplotlib.artist as martist
  File "/usr/lib/python3.7/site-packages/matplotlib/artist.py", line 16, in <module>
    from .path import Path
  File "/usr/lib/python3.7/site-packages/matplotlib/path.py", line 21, in <module>
    from . import _path, rcParams
ImportError: /usr/lib/python3.7/site-packages/matplotlib/_path.cpython-37m-x86_64-linux-gnu.so: undefined symbol: MPL_matplotlib_backends__backend_agg_ARRAY_API
Comment 14 Fitap 2020-05-28 05:07:39 UTC
I am also experiencing the same issue with matplotlib-2.2.-r1 and python 3.7.7 like many of you and the workaround is working for me is that comment #9 sudo MAKEOPTS="-j1" emerge --oneshot --ask  --ignore-default-opts --jobs=1 matplotlib