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

sci-mathematics/sage-doc build failure #790

Closed
jiffygist opened this issue Jul 21, 2024 · 10 comments
Closed

sci-mathematics/sage-doc build failure #790

jiffygist opened this issue Jul 21, 2024 · 10 comments

Comments

@jiffygist
Copy link

jiffygist commented Jul 21, 2024

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
Copy link
Author

jiffygist commented Jul 21, 2024

I was able to build after applying this guy's patch sagemath/sage#38242 (comment)

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
Copy link
Collaborator

kiwifb commented Jul 21, 2024

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
Copy link
Contributor

The docs build fine here with numpy-1.26.4.

@kiwifb
Copy link
Collaborator

kiwifb commented Jul 22, 2024

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

@kiwifb
Copy link
Collaborator

kiwifb commented Jul 22, 2024

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
Copy link
Contributor

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
Copy link
Contributor

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

@kiwifb
Copy link
Collaborator

kiwifb commented Jul 22, 2024

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
Copy link
Collaborator

kiwifb commented Jul 22, 2024

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

@kiwifb
Copy link
Collaborator

kiwifb commented Sep 3, 2024

OK this was about numpy 2.0.0. Closing.

@kiwifb kiwifb closed this as completed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants