#1074159 matplotlib: old system version blocks doc build for new version

Package:
src:matplotlib
Source:
src:matplotlib
Submitter:
Drew Parsons
Date:
2025-05-05 17:33:10 UTC
Severity:
normal
Tags:
#1074159#5
Date:
2024-06-23 23:08:46 UTC
From:
To:
I'm trying to reinstate python-matplotlib-doc.

The doc build essentially works.

But final doc build is blocked by circular dependencies and upstream
Issue#26827.

The confounding circular dependency is that python3-sphinx-gallery
Depends on python-matplotlib, but is needed to build docs for
matplotlib (it was previously handled as `<!stage1>` in the debian
build scripts).

In matplotlib 3.8.0, mpl_toolkits/__init__.py was removed to make
mpl_toolkits a "namespace package",
https://github.com/matplotlib/matplotlib/pull/25381

As side effect, it is no longer possible (that is, I have not found a
solution) to import mpl_toolkits from a local dir (i.e. the new 3.8.0
build).  It is possible to manipulate sys.path to get the local path
listed before the system path, e.g. with a sitecustomize.py file.  But
import mpl_toolkits or import mpl_toolkits.mplot3d always finds the
system version rather than the new version, and therefore the
component of matplotlib using it (projections/__init__.py) fails with
the error message

/build/matplotlib/.pybuild/cpython3_3.11/build/matplotlib/projections/__init__.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available.
  warnings.warn("Unable to import Axes3D. This may be due to multiple versions of "

The suggestion in upstream Issue#26827 to create a dummy
mpl_toolkits/__init__.py does not fix the problem.