Source: scipy Followup-For: Bug #1008680 The error on distutils is clouding the issue.
distutils is deprecated, packages need to update their code. scipy and sphinx are both aware about it and are dealing with it. But scipy uses distutils in its own build, and the deprecation warning is not triggering error there. sphinx does not usually treat a warning as an error, and the -W flag has not been invoked here. The problem is in the fine print. The sphinx error refers to a log file. Reading the log points the finger at pydata_sphinx_theme: File "/usr/lib/python3/dist-packages/pydata_sphinx_theme/__init__.py", line 14, in <module> from .bootstrap_html_translator import BootstrapHTML5Translator File "/usr/lib/python3/dist-packages/pydata_sphinx_theme/bootstrap_html_translator.py", line 3, in <module> from distutils.version import LooseVersion File "/usr/lib/python3.10/distutils/__init__.py", line 19, in <module> warnings.warn(_DEPRECATION_MESSAGE, DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives So even though sphinx is not supposed to treat warnings as errors, apparently this is happening with sphinx themes, or at least with pydata_sphinx_theme. The solution is either to instruct scipy to not use pydata_sphinx_theme for its docs, or patch pydata_sphinx_theme. The first might cause a growing snowball of problems depending on how scipy is using the pydata theme. pydata_sphinx_theme has a simple patch already at https://github.com/pydata/pydata-sphinx-theme/pull/590 Probably this is the best solution.