cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
79 stars 26 forks source link

sci-mathematics/sage-doc build failure #790

Closed jiffygist closed 2 days ago

jiffygist commented 1 month ago

I have dev-python/numpy version 2.0.0 installed.

Full build log

[plotting ] Importing line2d from here is deprecated; please use "from sage.plot.line import line2d" instead.
[plotting ] See https://github.com/sagemath/sage/issues/28717 for details.
[plotting ]   return getattr(obj, name, *defargs)
[plotting ] docstring of sage.plot.complex_plot.complex_plot:160: WARNING: Exception occurred in plotting complex_plot-8
[plotting ]  from /var/tmp/portage/sci-mathematics/sage-doc-10.4/work/sage-10.4/src/doc/en/reference/plotting/sage/plot/complex_plot.rst:
[plotting ] Traceback (most recent call last):
[plotting ]   File "/usr/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
[plotting ]     exec(code, ns)
[plotting ]   File "<string>", line 2, in <module>
[plotting ]   File "sage/misc/lazy_import.pyx", line 410, in sage.misc.lazy_import.LazyImport.__call__ (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/misc/lazy_import.c:6291)
[plotting ]     return self.get_object()(*args, **kwds)
[plotting ]   File "/usr/lib/python3.12/site-packages/sage/misc/decorators.py", line 497, in wrapper
[plotting ]     return func(*args, **options)
[plotting ]            ^^^^^^^^^^^^^^^^^^^^^^
[plotting ]   File "sage/plot/complex_plot.pyx", line 1221, in sage.plot.complex_plot.complex_plot (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:14985)
[plotting ]     rgbs = complex_to_cmap_rgb(
[plotting ]   File "sage/plot/complex_plot.pyx", line 623, in sage.plot.complex_plot.complex_to_cmap_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:11857)
[plotting ]     rgbs = add_contours_to_rgb(normalized_colors, lightdeltas, dark_rate=dark_rate)
[plotting ]   File "sage/plot/complex_plot.pyx", line 760, in sage.plot.complex_plot.add_contours_to_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:12472)
[plotting ]     hls = rgb_to_hls(rgb)
[plotting ]   File "sage/plot/complex_plot.pyx", line 1293, in sage.plot.complex_plot.rgb_to_hls (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:15662)
[plotting ]     delta = rgb.ptp(-1)
[plotting ] AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.
[plotting ] docstring of sage.plot.complex_plot.complex_plot:174: WARNING: Exception occurred in plotting complex_plot-9
[plotting ]  from /var/tmp/portage/sci-mathematics/sage-doc-10.4/work/sage-10.4/src/doc/en/reference/plotting/sage/plot/complex_plot.rst:
[plotting ] Traceback (most recent call last):
[plotting ]   File "/usr/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
[plotting ]     exec(code, ns)
[plotting ]   File "<string>", line 2, in <module>
[plotting ]   File "sage/misc/lazy_import.pyx", line 410, in sage.misc.lazy_import.LazyImport.__call__ (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/misc/lazy_import.c:6291)
[plotting ]     return self.get_object()(*args, **kwds)
[plotting ]   File "/usr/lib/python3.12/site-packages/sage/misc/decorators.py", line 497, in wrapper
[plotting ]     return func(*args, **options)
[plotting ]            ^^^^^^^^^^^^^^^^^^^^^^
[plotting ]   File "sage/plot/complex_plot.pyx", line 1221, in sage.plot.complex_plot.complex_plot (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:14985)
[plotting ]     rgbs = complex_to_cmap_rgb(
[plotting ]   File "sage/plot/complex_plot.pyx", line 623, in sage.plot.complex_plot.complex_to_cmap_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:11857)
[plotting ]     rgbs = add_contours_to_rgb(normalized_colors, lightdeltas, dark_rate=dark_rate)
[plotting ]   File "sage/plot/complex_plot.pyx", line 760, in sage.plot.complex_plot.add_contours_to_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:12472)
[plotting ]     hls = rgb_to_hls(rgb)
[plotting ]   File "sage/plot/complex_plot.pyx", line 1293, in sage.plot.complex_plot.rgb_to_hls (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:15662)
[plotting ]     delta = rgb.ptp(-1)
[plotting ] AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.
[plotting ] docstring of sage.plot.complex_plot.complex_plot:226: WARNING: Exception occurred in plotting complex_plot-13
[plotting ]  from /var/tmp/portage/sci-mathematics/sage-doc-10.4/work/sage-10.4/src/doc/en/reference/plotting/sage/plot/complex_plot.rst:
[plotting ] Traceback (most recent call last):
[plotting ]   File "/usr/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
[plotting ]     exec(code, ns)
[plotting ]   File "<string>", line 2, in <module>
[plotting ]   File "sage/misc/lazy_import.pyx", line 410, in sage.misc.lazy_import.LazyImport.__call__ (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/misc/lazy_import.c:6291)
[plotting ]     return self.get_object()(*args, **kwds)
[plotting ]   File "/usr/lib/python3.12/site-packages/sage/misc/decorators.py", line 497, in wrapper
[plotting ]     return func(*args, **options)
[plotting ]            ^^^^^^^^^^^^^^^^^^^^^^
[plotting ]   File "sage/plot/complex_plot.pyx", line 1221, in sage.plot.complex_plot.complex_plot (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:14985)
[plotting ]     rgbs = complex_to_cmap_rgb(
[plotting ]   File "sage/plot/complex_plot.pyx", line 623, in sage.plot.complex_plot.complex_to_cmap_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:11857)
[plotting ]     rgbs = add_contours_to_rgb(normalized_colors, lightdeltas, dark_rate=dark_rate)
[plotting ]   File "sage/plot/complex_plot.pyx", line 760, in sage.plot.complex_plot.add_contours_to_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:12472)
[plotting ]     hls = rgb_to_hls(rgb)
[plotting ]   File "sage/plot/complex_plot.pyx", line 1293, in sage.plot.complex_plot.rgb_to_hls (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:15662)
[plotting ]     delta = rgb.ptp(-1)
[plotting ] AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.
[plotting ] docstring of sage.plot.complex_plot.complex_plot:267: WARNING: Exception occurred in plotting complex_plot-17
[plotting ]  from /var/tmp/portage/sci-mathematics/sage-doc-10.4/work/sage-10.4/src/doc/en/reference/plotting/sage/plot/complex_plot.rst:
[plotting ] Traceback (most recent call last):
[plotting ]   File "/usr/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
[plotting ]     exec(code, ns)
[plotting ]   File "<string>", line 1, in <module>
[plotting ]   File "sage/misc/lazy_import.pyx", line 410, in sage.misc.lazy_import.LazyImport.__call__ (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/misc/lazy_import.c:6291)
[plotting ]     return self.get_object()(*args, **kwds)
[plotting ]   File "/usr/lib/python3.12/site-packages/sage/misc/decorators.py", line 497, in wrapper
[plotting ]     return func(*args, **options)
[plotting ]            ^^^^^^^^^^^^^^^^^^^^^^
[plotting ]   File "sage/plot/complex_plot.pyx", line 1221, in sage.plot.complex_plot.complex_plot (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:14985)
[plotting ]     rgbs = complex_to_cmap_rgb(
[plotting ]   File "sage/plot/complex_plot.pyx", line 623, in sage.plot.complex_plot.complex_to_cmap_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:11857)
[plotting ]     rgbs = add_contours_to_rgb(normalized_colors, lightdeltas, dark_rate=dark_rate)
[plotting ]   File "sage/plot/complex_plot.pyx", line 760, in sage.plot.complex_plot.add_contours_to_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:12472)
[plotting ]     hls = rgb_to_hls(rgb)
[plotting ]   File "sage/plot/complex_plot.pyx", line 1293, in sage.plot.complex_plot.rgb_to_hls (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:15662)
[plotting ]     delta = rgb.ptp(-1)
[plotting ] AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.
[plotting ] docstring of sage.plot.complex_plot.complex_plot:277: WARNING: Exception occurred in plotting complex_plot-18
[plotting ]  from /var/tmp/portage/sci-mathematics/sage-doc-10.4/work/sage-10.4/src/doc/en/reference/plotting/sage/plot/complex_plot.rst:
[plotting ] Traceback (most recent call last):
[plotting ]   File "/usr/lib/python3.12/site-packages/matplotlib/sphinxext/plot_directive.py", line 552, in _run_code
[plotting ]     exec(code, ns)
[plotting ]   File "<string>", line 1, in <module>
[plotting ]   File "sage/misc/lazy_import.pyx", line 410, in sage.misc.lazy_import.LazyImport.__call__ (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/misc/lazy_import.c:6291)
[plotting ]     return self.get_object()(*args, **kwds)
[plotting ]   File "/usr/lib/python3.12/site-packages/sage/misc/decorators.py", line 497, in wrapper
[plotting ]     return func(*args, **options)
[plotting ]            ^^^^^^^^^^^^^^^^^^^^^^
[plotting ]   File "sage/plot/complex_plot.pyx", line 1221, in sage.plot.complex_plot.complex_plot (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:14985)
[plotting ]     rgbs = complex_to_cmap_rgb(
[plotting ]   File "sage/plot/complex_plot.pyx", line 623, in sage.plot.complex_plot.complex_to_cmap_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:11857)
[plotting ]     rgbs = add_contours_to_rgb(normalized_colors, lightdeltas, dark_rate=dark_rate)
[plotting ]   File "sage/plot/complex_plot.pyx", line 760, in sage.plot.complex_plot.add_contours_to_rgb (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:12472)
[plotting ]     hls = rgb_to_hls(rgb)
[plotting ]   File "sage/plot/complex_plot.pyx", line 1293, in sage.plot.complex_plot.rgb_to_hls (/var/tmp/portage/sci-mathematics/sagemath-standard-10.4/work/sagemath_standard-10.4-python3_12/build/cythonized/sage/plot/complex_plot.c:15662)
[plotting ]     delta = rgb.ptp(-1)
[plotting ] AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.
[plotting ] The inventory file is in ../../../build_doc/inventory/en/reference/plotting.
jiffygist commented 1 month ago

I was able to build after applying this guy's patch https://github.com/sagemath/sage/issues/38242#issuecomment-2180437545

I have put it in /etc/portage/patches/sci-mathematics/sagemath-standard/numpy_fix.diff

--- a/sage/plot/complex_plot.pyx
+++ b/sage/plot/complex_plot.pyx
@@ -1290,7 +1290,7 @@ def rgb_to_hls(rgb):
     l = (rgb_max + rgb_min)/2.0  # lightness

     hls = np.zeros_like(rgb)
-    delta = rgb.ptp(-1)
+    delta = np.ptp(rgb, -1)
     s = np.zeros_like(delta)

     ipos = delta > 0
kiwifb commented 1 month ago

There were some patch for numpy 2.0 compatibility, I thought they had made it into 10.4 - obviously not. I will include the full support patch. More interesting to me, you build the doc without issue? I had an issue with intersphinx and ipywdgets the last time I tried and I was waiting for feedback to work out if it was just a problem on my system.

strogdon commented 1 month ago

The docs build fine here with numpy-1.26.4.

kiwifb commented 1 month ago

sagemath-standard-10.4-r1 pushed and sage-doc-10.4 amended to include upstream numpy 2.0 support patch.

kiwifb commented 1 month ago

The docs build fine here with numpy-1.26.4.

I may have caught the tree in the slightly broken state when I tried to build 9999 on Saturday. Or there was an issue with ipywidget intersphinx file upstream. Builds fine now.

strogdon commented 1 month ago

I now get a failure building sage-doc-9999 with numpy-2.0.0 installed:

[plotting ] AttributeError: `ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead.
[plotting ] The inventory file is in ../../../build_doc/inventory/en/reference/plotting.
Error building the documentation.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/lib/python3.12/site-packages/sage_docbuild/__main__.py", line 530, in <module>
    sys.exit(main())

as in the first post. No additional patch was used.

strogdon commented 1 month ago

It looks like sagemath-standard-9999 needs to be updated to allow for numpy-2.0.0.

kiwifb commented 1 month ago

Now I get what you mean! Of course right now 9999 should be the latest rc of 10.4. But in the vbraun branch where things have started to move for the first beta of 10.5, numpy 2.0 support has been merged (at least tentatively). I guess, I'll get you out of that limbo on the master branch.

kiwifb commented 1 month ago

Pushed fix on the master branch for 9999 build. Hopefully this is enough to build.

kiwifb commented 2 days ago

OK this was about numpy 2.0.0. Closing.