Skip to content

Conversation

rbebb
Copy link
Contributor

@rbebb rbebb commented Apr 13, 2025

This updates SciPy to 1.9.3 which should provide support for Python 3.8 through 3.11. I did my testing with Python 3.11.

One thing to note is that I had to hardcode some paths for Fortran in SciPy's setup.py file (despite seemingly placing the Fortran library for Android in the proper folder). If anyone knows how to avoid hardcording the path for Fortran, I can update the patch file!

Closes #1237

@rbebb rbebb changed the title Update SciPy to 1.9.3 [#1237] Update SciPy to 1.9.3 Apr 14, 2025
@rbebb rbebb changed the title [#1237] Update SciPy to 1.9.3 #1237 Update SciPy to 1.9.3 Apr 14, 2025
@rbebb rbebb changed the title #1237 Update SciPy to 1.9.3 [#1237] Update SciPy to 1.9.3 Apr 14, 2025
@mhsmith
Copy link
Member

mhsmith commented Apr 20, 2025

Have you tested your builds with the pkgtest app as described in "Testing a package" in the README? If so, which Python versions and ABIs have you checked?

Comment on lines +1 to +5
{% if PY_VER == "3.8" %}
{% set numpy_version = "1.19.5" %}
{% elif PY_VER in ["3.9", "3.10", "3.11"] %}
{% set numpy_version = "1.23.3" %}
{% endif %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need for this, because we aren't building new packages for Python 3.8 anymore.

Comment on lines +144 to +146
+ /* Chaquopy: Prevent C/C++ macro collision */
+ #ifndef __cplusplus
+ #ifndef isnan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this patch necessary – what error message do you get without it?

And why is __cplusplus the appropriate way of doing it? Is this file included in any C++ code? If not, then the __cplusplus check is just equivalent to disabling the code completely.

If the patch is necessary, then the inner #ifndef should be left at its original indentation to make the patch easier to read.


from scipy._build_utils import numpy_nodepr_api

-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change appears to be insignificant.

Comment on lines +220 to +221
-cdef void _visit_voronoi(qhT *_qh, void *ptr, vertexT *vertex, vertexT *vertexA,
+cdef void _visit_voronoi(qhT *_qh, FILE *ptr, vertexT *vertex, vertexT *vertexA,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a "Chaquopy: " comment saying that you changed void to FILE, and explaining why that was necessary.

Comment on lines 233 to 235
-import numpy
-
+# Chaquopy: skip "import numpy"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there some reason to change this? The previous version was less disruptive, as it retained the two lines after the imports.

codelens = [len(x) for x in all_codes]
- last = numpy.prod(codelens) - 1
+
+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid insignificant whitespace changes.

Comment on lines +272 to +273
+ # Chaquopy: Force return
+ return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says what you're doing, but it doesn't explain why. If the rest of the function would cause some problem, then include a comment saying what it was.

Comment on lines +301 to +303
+os.environ["FC"] = os.path.join(os.path.expanduser("~"), "Downloads/gcc-arm64-linux-x86_64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gfortran")
+os.environ["F77"] = os.path.join(os.path.expanduser("~"), "Downloads/gcc-arm64-linux-x86_64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gfortran")
+os.environ["F90"] = os.path.join(os.path.expanduser("~"), "Downloads/gcc-arm64-linux-x86_64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gfortran")
Copy link
Member

@mhsmith mhsmith Apr 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to note is that I had to hardcode some paths for Fortran in SciPy's setup.py file (despite seemingly placing the Fortran library for Android in the proper folder).

The proper folder is not ~/Downloads, but chaquopy/server/pypi/fortran, as it says in pypi/README.md. build-wheel.py sets these environment variables to point into that location.

@mhsmith
Copy link
Member

mhsmith commented Jul 26, 2025

If you want to proceed with this, please respond to my previous comments, and I'll reopen the PR.

@mhsmith mhsmith closed this Jul 26, 2025
@mhsmith
Copy link
Member

mhsmith commented Jul 26, 2025

Actually, I'll leave this open for future reference, since it does contain some potentially useful patch updates.

@mhsmith mhsmith reopened this Jul 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

SciPy for Python 3.11 or later
2 participants