Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: netBSD packaging build broken for 3.9 #28260

Closed
0-wiz-0 opened this issue May 19, 2024 · 10 comments
Closed

[Bug]: netBSD packaging build broken for 3.9 #28260

0-wiz-0 opened this issue May 19, 2024 · 10 comments

Comments

@0-wiz-0
Copy link

0-wiz-0 commented May 19, 2024

Bug summary

Hi! I've tried updating the pkgsrc package for matplotlib to 3.9.0 and ran the self tests to confirm it works, but I got an error about a missing symbol. I think the symbol should come from the included external agg24-svn library. I see the following weird output in the build log:

[1/40] Generating lib/matplotlib/mpl-data/matplotlibrc with a custom command
[2/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_vpgen_segmentator.cpp.o
[3/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_trans_affine.cpp.o
[4/40] Compiling C++ object extern/ttconv/libttconv.a.p/ttutil.cpp.o
[5/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_bezier_arc.cpp.o
[6/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_vcgen_dash.cpp.o
[7/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_image_filters.cpp.o
[8/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_curves.cpp.o
[9/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_vcgen_stroke.cpp.o
[10/40] Compiling C++ object extern/agg24-svn/libagg.a.p/src_agg_vcgen_contour.cpp.o
[11/40] Linking static target extern/agg24-svn/libagg.a
ar: extern/agg24-svn/libagg.a.p/src_agg_bezier_arc.cpp.o: plugin needed to handle lto object
[12/40] Compiling C++ object extern/ttconv/libttconv.a.p/pprdrv_tt.cpp.o
[13/40] Compiling C++ object extern/ttconv/libttconv.a.p/pprdrv_tt2.cpp.o
[14/40] Linking static target extern/ttconv/libttconv.a
ar: extern/ttconv/libttconv.a.p/pprdrv_tt2.cpp.o: plugin needed to handle lto object

I'm not sure what that wants to tell me.

Code for reproduction

Try to build matplotlib 3.9.0, run self tests.

Actual outcome

___________________________________________________________________________ ERROR collecting lib/matplotlib/testing ___________________________________________________________________________
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
lib/matplotlib/cbook.py:32: in <module>
    from matplotlib import _api, _c_internal_utils
E   ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
____________________________________________________________________________ ERROR collecting lib/matplotlib/tests ____________________________________________________________________________
/usr/pkg/lib/python3.12/site-packages/pluggy/_manager.py:169: in register
    hook._maybe_apply_history(hookimpl)
/usr/pkg/lib/python3.12/site-packages/pluggy/_hooks.py:581: in _maybe_apply_history
    res = self._hookexec(self.name, [method], kwargs, False)
/usr/pkg/lib/python3.12/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
lib/matplotlib/testing/conftest.py:27: in pytest_configure
    matplotlib.use('agg', force=True)
E   AttributeError: module 'matplotlib' has no attribute 'use'
_____________________________________________________________________ ERROR collecting lib/mpl_toolkits/axes_grid1/tests ______________________________________________________________________
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/mpl_toolkits/axes_grid1/__init__.py:1: in <module>
    from . import axes_size as Size
lib/mpl_toolkits/axes_grid1/axes_size.py:15: in <module>
    from matplotlib.axes import Axes
lib/matplotlib/axes/__init__.py:1: in <module>
    from . import _base
lib/matplotlib/axes/_base.py:14: in <module>
    from matplotlib import _api, cbook, _docstring, offsetbox
lib/matplotlib/cbook.py:32: in <module>
    from matplotlib import _api, _c_internal_utils
E   ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
_____________________________________________________________________ ERROR collecting lib/mpl_toolkits/axisartist/tests ______________________________________________________________________
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/mpl_toolkits/axisartist/__init__.py:1: in <module>
    from .axislines import Axes
lib/mpl_toolkits/axisartist/axislines.py:46: in <module>
    import matplotlib.axes as maxes
lib/matplotlib/axes/__init__.py:1: in <module>
    from . import _base
lib/matplotlib/axes/_base.py:14: in <module>
    from matplotlib import _api, cbook, _docstring, offsetbox
lib/matplotlib/cbook.py:32: in <module>
    from matplotlib import _api, _c_internal_utils
E   ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
_______________________________________________________________________ ERROR collecting lib/mpl_toolkits/mplot3d/tests _______________________________________________________________________
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/mpl_toolkits/mplot3d/__init__.py:1: in <module>
    from .axes3d import Axes3D
lib/mpl_toolkits/mplot3d/axes3d.py:21: in <module>
    from matplotlib import _api, cbook, _docstring, _preprocess_data
lib/matplotlib/cbook.py:32: in <module>
    from matplotlib import _api, _c_internal_utils
E   ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
=================================================================================== short test summary info ===================================================================================
ERROR lib/matplotlib/testing - ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
ERROR lib/matplotlib/tests - AttributeError: module 'matplotlib' has no attribute 'use'
ERROR lib/mpl_toolkits/axes_grid1/tests - ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
ERROR lib/mpl_toolkits/axisartist/tests - ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
ERROR lib/mpl_toolkits/mplot3d/tests - ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/graphics/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================================== 5 errors in 0.38s ======================================================================================

Expected outcome

Successful test.

Additional information

No response

Operating system

NetBSD 10.99.10/amd64

Matplotlib Version

3.9.0

Matplotlib Backend

fails due to missing symbol

Python version

3.12.3

Jupyter version

n/a

Installation

from source (.tar.gz)

@tacaswell
Copy link
Member

I'm not seeing a missing symbol in the logs, I'm seeing that one of our c-extensions did not get built/installed correctly.

The module that is failing is https://github.com/matplotlib/matplotlib/blob/main/src/_c_internal_utils.cpp which does not use Agg (it is mostly some windows related code and checking if we have any sort of running X or wayland server available).

We switched to building with meson for 3.9, I suspect that the packaging in netbsd will need to be updated to patch meson.options rather than mplsetup.cfg to use the system provided qhull + freetype (see https://github.com/matplotlib/matplotlib/blob/main/meson.options)

https://matplotlib.org/stable/install/dependencies.html for the current dependencies. I looked at https://github.com/NetBSD/pkgsrc/tree/trunk/graphics/py-matplotlib which I think is what you are using? I'm not familiar enough with netBSD's build tooling to diagnose what is wrong (I assume one of the includes in the make file pulls in the actual build/install commands?).

@tacaswell tacaswell changed the title [Bug]: [Bug]: netBSD packaging build broken for 3.9 May 19, 2024
@0-wiz-0
Copy link
Author

0-wiz-0 commented May 19, 2024

I've put the update package at https://github.com/NetBSD/pkgsrc-wip/tree/master/py-matplotlib
I've already updated it for the tool switch, and it's using qhull and freetype2 from pkgsrc.

I think it's related to agg because of this:

pytest-3.12 -ra -m 'not network'
=================================================================================== test session starts ===================================================================================
platform netbsd10 -- Python 3.12.3, pytest-8.2.0, pluggy-1.5.0
rootdir: /usr/pkgsrc/wip/py-matplotlib
collected 0 items / 7 errors

========================================================================================= ERRORS ==========================================================================================
______________________________________ ERROR collecting work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py ______________________________________
ImportError while importing test module '/usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py:9: in <module>
    import matplotlib.pyplot as plt
/usr/pkg/lib/python3.12/site-packages/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
/usr/pkg/lib/python3.12/site-packages/matplotlib/rcsetup.py:28: in <module>
    from matplotlib.colors import Colormap, is_color_like
/usr/pkg/lib/python3.12/site-packages/matplotlib/colors.py:57: in <module>
    from matplotlib import _api, _cm, cbook, scale
/usr/pkg/lib/python3.12/site-packages/matplotlib/scale.py:22: in <module>
    from matplotlib.ticker import (
/usr/pkg/lib/python3.12/site-packages/matplotlib/ticker.py:144: in <module>
    from matplotlib import transforms as mtransforms
/usr/pkg/lib/python3.12/site-packages/matplotlib/transforms.py:49: in <module>
    from matplotlib._path import (
E   ImportError: /usr/pkg/lib/python3.12/site-packages/matplotlib/_path.so: Undefined PLT symbol "_ZN3agg17vpgen_segmentator7move_toEdd" (symnum = 5)
______________________________________________________ ERROR collecting work/matplotlib-3.9.0/galleries/examples/units/evans_test.py ______________________________________________________
ImportError while importing test module '/usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/galleries/examples/units/evans_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
work/matplotlib-3.9.0/galleries/examples/units/evans_test.py:12: in <module>
    import matplotlib.pyplot as plt
/usr/pkg/lib/python3.12/site-packages/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
/usr/pkg/lib/python3.12/site-packages/matplotlib/rcsetup.py:28: in <module>
    from matplotlib.colors import Colormap, is_color_like
/usr/pkg/lib/python3.12/site-packages/matplotlib/colors.py:57: in <module>
    from matplotlib import _api, _cm, cbook, scale
/usr/pkg/lib/python3.12/site-packages/matplotlib/scale.py:22: in <module>
    from matplotlib.ticker import (
/usr/pkg/lib/python3.12/site-packages/matplotlib/ticker.py:144: in <module>
    from matplotlib import transforms as mtransforms
/usr/pkg/lib/python3.12/site-packages/matplotlib/transforms.py:49: in <module>
    from matplotlib._path import (
E   ImportError: /usr/pkg/lib/python3.12/site-packages/matplotlib/_path.so: Undefined PLT symbol "_ZN3agg17vpgen_segmentator7move_toEdd" (symnum = 5)
______________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/matplotlib/testing ______________________________________________________________
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
work/matplotlib-3.9.0/lib/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
work/matplotlib-3.9.0/lib/matplotlib/rcsetup.py:28: in <module>
    from matplotlib.colors import Colormap, is_color_like
work/matplotlib-3.9.0/lib/matplotlib/colors.py:57: in <module>
    from matplotlib import _api, _cm, cbook, scale
work/matplotlib-3.9.0/lib/matplotlib/scale.py:22: in <module>
    from matplotlib.ticker import (
work/matplotlib-3.9.0/lib/matplotlib/ticker.py:144: in <module>
    from matplotlib import transforms as mtransforms
work/matplotlib-3.9.0/lib/matplotlib/transforms.py:49: in <module>
    from matplotlib._path import (
E   ModuleNotFoundError: No module named 'matplotlib._path'
_______________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/matplotlib/tests _______________________________________________________________
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
work/matplotlib-3.9.0/lib/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
work/matplotlib-3.9.0/lib/matplotlib/rcsetup.py:28: in <module>
    from matplotlib.colors import Colormap, is_color_like
work/matplotlib-3.9.0/lib/matplotlib/colors.py:57: in <module>
    from matplotlib import _api, _cm, cbook, scale
work/matplotlib-3.9.0/lib/matplotlib/scale.py:22: in <module>
    from matplotlib.ticker import (
work/matplotlib-3.9.0/lib/matplotlib/ticker.py:144: in <module>
    from matplotlib import transforms as mtransforms
work/matplotlib-3.9.0/lib/matplotlib/transforms.py:49: in <module>
    from matplotlib._path import (
E   ModuleNotFoundError: No module named 'matplotlib._path'
________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/mpl_toolkits/axes_grid1/tests _________________________________________________________
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
work/matplotlib-3.9.0/lib/mpl_toolkits/axes_grid1/__init__.py:1: in <module>
    from . import axes_size as Size
work/matplotlib-3.9.0/lib/mpl_toolkits/axes_grid1/axes_size.py:14: in <module>
    from matplotlib import _api
work/matplotlib-3.9.0/lib/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
work/matplotlib-3.9.0/lib/matplotlib/rcsetup.py:28: in <module>
    from matplotlib.colors import Colormap, is_color_like
work/matplotlib-3.9.0/lib/matplotlib/colors.py:57: in <module>
    from matplotlib import _api, _cm, cbook, scale
work/matplotlib-3.9.0/lib/matplotlib/scale.py:22: in <module>
    from matplotlib.ticker import (
work/matplotlib-3.9.0/lib/matplotlib/ticker.py:144: in <module>
    from matplotlib import transforms as mtransforms
work/matplotlib-3.9.0/lib/matplotlib/transforms.py:49: in <module>
    from matplotlib._path import (
E   ModuleNotFoundError: No module named 'matplotlib._path'
________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/mpl_toolkits/axisartist/tests _________________________________________________________
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
work/matplotlib-3.9.0/lib/mpl_toolkits/axisartist/__init__.py:1: in <module>
    from .axislines import Axes
work/matplotlib-3.9.0/lib/mpl_toolkits/axisartist/axislines.py:44: in <module>
    import matplotlib as mpl
work/matplotlib-3.9.0/lib/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
work/matplotlib-3.9.0/lib/matplotlib/rcsetup.py:28: in <module>
    from matplotlib.colors import Colormap, is_color_like
work/matplotlib-3.9.0/lib/matplotlib/colors.py:57: in <module>
    from matplotlib import _api, _cm, cbook, scale
work/matplotlib-3.9.0/lib/matplotlib/scale.py:22: in <module>
    from matplotlib.ticker import (
work/matplotlib-3.9.0/lib/matplotlib/ticker.py:144: in <module>
    from matplotlib import transforms as mtransforms
work/matplotlib-3.9.0/lib/matplotlib/transforms.py:49: in <module>
    from matplotlib._path import (
E   ModuleNotFoundError: No module named 'matplotlib._path'
__________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/mpl_toolkits/mplot3d/tests __________________________________________________________
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
work/matplotlib-3.9.0/lib/mpl_toolkits/mplot3d/__init__.py:1: in <module>
    from .axes3d import Axes3D
work/matplotlib-3.9.0/lib/mpl_toolkits/mplot3d/axes3d.py:20: in <module>
    import matplotlib as mpl
work/matplotlib-3.9.0/lib/matplotlib/__init__.py:159: in <module>
    from . import _api, _version, cbook, _docstring, rcsetup
work/matplotlib-3.9.0/lib/matplotlib/rcsetup.py:28: in <module>
    from matplotlib.colors import Colormap, is_color_like
work/matplotlib-3.9.0/lib/matplotlib/colors.py:57: in <module>
    from matplotlib import _api, _cm, cbook, scale
work/matplotlib-3.9.0/lib/matplotlib/scale.py:22: in <module>
    from matplotlib.ticker import (
work/matplotlib-3.9.0/lib/matplotlib/ticker.py:144: in <module>
    from matplotlib import transforms as mtransforms
work/matplotlib-3.9.0/lib/matplotlib/transforms.py:49: in <module>
    from matplotlib._path import (
E   ModuleNotFoundError: No module named 'matplotlib._path'
================================================================================= short test summary info =================================================================================
ERROR work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py
ERROR work/matplotlib-3.9.0/galleries/examples/units/evans_test.py
ERROR work/matplotlib-3.9.0/lib/matplotlib/testing - ModuleNotFoundError: No module named 'matplotlib._path'
ERROR work/matplotlib-3.9.0/lib/matplotlib/tests - ModuleNotFoundError: No module named 'matplotlib._path'
ERROR work/matplotlib-3.9.0/lib/mpl_toolkits/axes_grid1/tests - ModuleNotFoundError: No module named 'matplotlib._path'
ERROR work/matplotlib-3.9.0/lib/mpl_toolkits/axisartist/tests - ModuleNotFoundError: No module named 'matplotlib._path'
ERROR work/matplotlib-3.9.0/lib/mpl_toolkits/mplot3d/tests - ModuleNotFoundError: No module named 'matplotlib._path'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 7 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================================== 7 errors in 1.78s ====================================================================================
*** Error code 2

Stop.
make[1]: stopped in /usr/pkgsrc/wip/py-matplotlib
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/wip/py-matplotlib

which has in the middle a couple lines like

E   ImportError: /usr/pkg/lib/python3.12/site-packages/matplotlib/_path.so: Undefined PLT symbol "_ZN3agg17vpgen_segmentator7move_toEdd" (symnum = 5)

@tacaswell
Copy link
Member

Maybe turn off LTO? We turn it on by default.

@0-wiz-0
Copy link
Author

0-wiz-0 commented May 20, 2024

Thank you, turning off LTO fixes the missing symbol problem!

I still can't get the tests to run though. In both cases I install matplotlib. When I run py-test in the build directory, I get (see above):

E   ImportError: cannot import name '_c_internal_utils' from 'matplotlib' (/scratch/wip/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/__init__.py)

in the collection step (5 times); when I run it somewhere else (not in the build directory), I get:

collected 277 items / 2 errors

========================================================================================= ERRORS ==========================================================================================
______________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/matplotlib/testing ______________________________________________________________
/usr/pkg/lib/python3.12/site-packages/_pytest/config/__init__.py:717: in _importconftest
    mod = import_path(
/usr/pkg/lib/python3.12/site-packages/_pytest/pathlib.py:614: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('matplotlib.testing.conftest', '/usr/pkg/lib/python3.12/site-packages/matplotlib/testing/conftest.py', PosixPath('/usr/pkgsrc/wip/py-matplotl
ib/work/matplotlib-3.9.0/lib/matplotlib/testing/conftest.py'))
_______________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/matplotlib/tests _______________________________________________________________
/usr/pkg/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
/usr/pkg/lib/python3.12/site-packages/matplotlib/tests/__init__.py:6: in <module>
    raise OSError(
E   OSError: The baseline image directory does not exist. This is most likely because the test data is not installed. You may need to install matplotlib from source to get the test data.
==================================================================================== warnings summary =====================================================================================
work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py:25
  /usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py:25: UserWarning: FigureCanvasAgg is non-interactive, and thus
cannot be shown
    plt.show()

work/matplotlib-3.9.0/galleries/examples/units/evans_test.py:87
  /usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/galleries/examples/units/evans_test.py:87: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
    plt.show()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================= short test summary info =================================================================================
ERROR work/matplotlib-3.9.0/lib/matplotlib/testing - _pytest.pathlib.ImportPathMismatchError: ('matplotlib.testing.conftest', '/usr/pkg/lib/python3.12/site-packages/matplotlib/testing/con
ftest.py', PosixPath('/usr/pkgsrc/wip/py-matplot...
ERROR work/matplotlib-3.9.0/lib/matplotlib/tests - OSError: The baseline image directory does not exist. This is most likely because the test data is not installed. You may need to instal
l matplotlib from source to get the test data.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================== 2 warnings, 2 errors in 0.81s ==============================================================================

Here's the list of installed files matching image:

${PYSITELIB}/matplotlib/_image.pyi
${PYSITELIB}/matplotlib/_image.so
${PYSITELIB}/matplotlib/image.py
${PYSITELIB}/matplotlib/image.pyc
${PYSITELIB}/matplotlib/image.pyi
${PYSITELIB}/matplotlib/image.pyo
${PYSITELIB}/matplotlib/mpl-data/images/back-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/back.pdf
${PYSITELIB}/matplotlib/mpl-data/images/back.png
${PYSITELIB}/matplotlib/mpl-data/images/back.svg
${PYSITELIB}/matplotlib/mpl-data/images/back_large.png
${PYSITELIB}/matplotlib/mpl-data/images/filesave-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/filesave.pdf
${PYSITELIB}/matplotlib/mpl-data/images/filesave.png
${PYSITELIB}/matplotlib/mpl-data/images/filesave.svg
${PYSITELIB}/matplotlib/mpl-data/images/filesave_large.png
${PYSITELIB}/matplotlib/mpl-data/images/forward-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/forward.pdf
${PYSITELIB}/matplotlib/mpl-data/images/forward.png
${PYSITELIB}/matplotlib/mpl-data/images/forward.svg
${PYSITELIB}/matplotlib/mpl-data/images/forward_large.png
${PYSITELIB}/matplotlib/mpl-data/images/hand.pdf
${PYSITELIB}/matplotlib/mpl-data/images/hand.png
${PYSITELIB}/matplotlib/mpl-data/images/hand.svg
${PYSITELIB}/matplotlib/mpl-data/images/help-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/help.pdf
${PYSITELIB}/matplotlib/mpl-data/images/help.png
${PYSITELIB}/matplotlib/mpl-data/images/help.svg
${PYSITELIB}/matplotlib/mpl-data/images/help_large.png
${PYSITELIB}/matplotlib/mpl-data/images/home-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/home.pdf
${PYSITELIB}/matplotlib/mpl-data/images/home.png
${PYSITELIB}/matplotlib/mpl-data/images/home.svg
${PYSITELIB}/matplotlib/mpl-data/images/home_large.png
${PYSITELIB}/matplotlib/mpl-data/images/matplotlib.pdf
${PYSITELIB}/matplotlib/mpl-data/images/matplotlib.png
${PYSITELIB}/matplotlib/mpl-data/images/matplotlib.svg
${PYSITELIB}/matplotlib/mpl-data/images/matplotlib_large.png
${PYSITELIB}/matplotlib/mpl-data/images/move-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/move.pdf
${PYSITELIB}/matplotlib/mpl-data/images/move.png
${PYSITELIB}/matplotlib/mpl-data/images/move.svg
${PYSITELIB}/matplotlib/mpl-data/images/move_large.png
${PYSITELIB}/matplotlib/mpl-data/images/qt4_editor_options.pdf
${PYSITELIB}/matplotlib/mpl-data/images/qt4_editor_options.png
${PYSITELIB}/matplotlib/mpl-data/images/qt4_editor_options.svg
${PYSITELIB}/matplotlib/mpl-data/images/qt4_editor_options_large.png
${PYSITELIB}/matplotlib/mpl-data/images/subplots-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/subplots.pdf
${PYSITELIB}/matplotlib/mpl-data/images/subplots.png
${PYSITELIB}/matplotlib/mpl-data/images/subplots.svg
${PYSITELIB}/matplotlib/mpl-data/images/subplots_large.png
${PYSITELIB}/matplotlib/mpl-data/images/zoom_to_rect-symbolic.svg
${PYSITELIB}/matplotlib/mpl-data/images/zoom_to_rect.pdf
${PYSITELIB}/matplotlib/mpl-data/images/zoom_to_rect.png
${PYSITELIB}/matplotlib/mpl-data/images/zoom_to_rect.svg
${PYSITELIB}/matplotlib/mpl-data/images/zoom_to_rect_large.png
${PYSITELIB}/matplotlib/tests/test_compare_images.py
${PYSITELIB}/matplotlib/tests/test_compare_images.pyc
${PYSITELIB}/matplotlib/tests/test_compare_images.pyo
${PYSITELIB}/matplotlib/tests/test_image.py
${PYSITELIB}/matplotlib/tests/test_image.pyc
${PYSITELIB}/matplotlib/tests/test_image.pyo

@0-wiz-0
Copy link
Author

0-wiz-0 commented May 20, 2024

(That's with the pypi matplotlib 3.9.0 source files.)

@QuLogic
Copy link
Member

QuLogic commented May 21, 2024

You need to install the test data; please read the release notes for the build change.

@0-wiz-0
Copy link
Author

0-wiz-0 commented May 21, 2024

Thank you for the pointer. I changed the meson arguments as suggested and many more files were installed.
Now I get (after installation, running it from outside the build directory):

pytest-3.12 -ra -m 'not network'
=========================================================================================== test session starts ============================================================================================
platform netbsd10 -- Python 3.12.3, pytest-8.2.1, pluggy-1.5.0
rootdir: /usr/pkgsrc/wip/py-matplotlib
collected 277 items / 2 errors

================================================================================================== ERRORS ==================================================================================================
______________________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/matplotlib/testing _______________________________________________________________________
/usr/pkg/lib/python3.12/site-packages/_pytest/config/__init__.py:717: in _importconftest
    mod = import_path(
/usr/pkg/lib/python3.12/site-packages/_pytest/pathlib.py:614: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('matplotlib.testing.conftest', '/usr/pkg/lib/python3.12/site-packages/matplotlib/testing/conftest.py', PosixPath('/usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/testing/conftest.py'))
_______________________________________________________________________ ERROR collecting work/matplotlib-3.9.0/lib/matplotlib/tests ________________________________________________________________________
/usr/pkg/lib/python3.12/site-packages/_pytest/config/__init__.py:717: in _importconftest
    mod = import_path(
/usr/pkg/lib/python3.12/site-packages/_pytest/pathlib.py:614: in import_path
    raise ImportPathMismatchError(module_name, module_file, path)
E   _pytest.pathlib.ImportPathMismatchError: ('matplotlib.tests.conftest', '/usr/pkg/lib/python3.12/site-packages/matplotlib/tests/conftest.py', PosixPath('/usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/tests/conftest.py'))
============================================================================================= warnings summary =============================================================================================
work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py:25
  /usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/galleries/examples/text_labels_and_annotations/usetex_baseline_test.py:25: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
    plt.show()

work/matplotlib-3.9.0/galleries/examples/units/evans_test.py:87
  /usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/galleries/examples/units/evans_test.py:87: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown
    plt.show()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================================= short test summary info ==========================================================================================
ERROR work/matplotlib-3.9.0/lib/matplotlib/testing - _pytest.pathlib.ImportPathMismatchError: ('matplotlib.testing.conftest', '/usr/pkg/lib/python3.12/site-packages/matplotlib/testing/conftest.py', PosixPath('/usr/pkgsrc/wip/py-matplotlib/work/matplotl...
ERROR work/matplotlib-3.9.0/lib/matplotlib/tests - _pytest.pathlib.ImportPathMismatchError: ('matplotlib.tests.conftest', '/usr/pkg/lib/python3.12/site-packages/matplotlib/tests/conftest.py', PosixPath('/usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================================== 2 warnings, 2 errors in 1.01s =======================================================================================

The installed file has:

# cat /usr/pkg/lib/python3.12/site-packages/matplotlib/tests/conftest.py
from matplotlib.testing.conftest import (  # noqa
    mpl_test_settings, pytest_configure, pytest_unconfigure, pd, xr)

and the non-installed file (why is that even found?) is the same

# cat /usr/pkgsrc/wip/py-matplotlib/work/matplotlib-3.9.0/lib/matplotlib/tests/conftest.py
from matplotlib.testing.conftest import (  # noqa
    mpl_test_settings, pytest_configure, pytest_unconfigure, pd, xr)

Any ideas?

@QuLogic
Copy link
Member

QuLogic commented May 24, 2024

Loading from the current directory is how pytest works by default; if you want to test the installed copy, you need to ask it with --pyargs: https://docs.pytest.org/en/8.2.x/how-to/usage.html#specifying-which-tests-to-run.

@QuLogic
Copy link
Member

QuLogic commented Jun 3, 2024

ar: extern/agg24-svn/libagg.a.p/src_agg_bezier_arc.cpp.o: plugin needed to handle lto object

I just noticed this in the output; you probably need to set AR=gcc-ar or similar in the environment so that the ar will have loaded the LTO plugin. Then you won't have to disable LTO. That's something specific to netBSD though, so I'm not sure the exact binary.

@0-wiz-0
Copy link
Author

0-wiz-0 commented Jun 6, 2024

Thanks for the help.
I don't particularly care using the installed tests, I would have preferred to test using the data from the source/build directories instead, but I couldn't get that to work.
With --pyargs I can run the tests:

928 failed, 6776 passed, 1785 skipped, 33 xfailed

some complain about missing dependencies like pikepdf, ghostscript, TeX, but most say that the images are not close.

About gcc-ar: that does not exist on NetBSD, but ar is just ar from GNU binutils 2.39.

Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants