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

sage.env.sage_include_directories: Remove hard dependency on numpy #31333

Closed
mkoeppe opened this issue Feb 3, 2021 · 21 comments
Closed

sage.env.sage_include_directories: Remove hard dependency on numpy #31333

mkoeppe opened this issue Feb 3, 2021 · 21 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Feb 3, 2021

(extracted from and needed for #29865)

sage_include_directories returns the basic list of include directories for compiling extensions, not including directories obtained through pkgconfig etc. This basic list includes directories supplied by numpy. This is fine for the monolithic Sage library because numpy is a standard package; but in the course of modularization, we will have various distributions that do not need the dependency on numpy.
We use try/expect around the import and call to numpy.

CC: @kiwifb @tobiasdiez

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: 4550eb6

Reviewer: François Bissey

Issue created by migration from https://trac.sagemath.org/ticket/31333

@mkoeppe mkoeppe added this to the sage-9.3 milestone Feb 3, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 4, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 4, 2021

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 4, 2021

Commit: 19776a3

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 4, 2021

New commits:

19776a3sage.env.sage_include_directories: Do not fail if numpy cannot be imported

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 4, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

e16ba2dsrc/sage/doctest/control.py: Do not fail if sage.libs.arb cannot be imported

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 4, 2021

Changed commit from 19776a3 to e16ba2d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 4, 2021

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 4, 2021

Changed commit from e16ba2d to 19776a3

@tobiasdiez
Copy link
Contributor

comment:5

I think there should still be a log message if numpy couldn't be found, since otherwise errors further down the compile chain might be hard to track down.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 14, 2021
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 25, 2021

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

4550eb6sage.env.sage_include_directories: Do not fail if numpy cannot be imported

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 25, 2021

Changed commit from 19776a3 to 4550eb6

@mkoeppe

This comment has been minimized.

@kiwifb
Copy link
Member

kiwifb commented Jun 26, 2021

comment:9

The branch looks fine. Can the description be a bit more verbose on what this change will achieve? Obviously it makes the thing touched more resilient but for what purpose.

@mkoeppe

This comment has been minimized.

@kiwifb
Copy link
Member

kiwifb commented Jun 26, 2021

Reviewer: François Bissey

@kiwifb
Copy link
Member

kiwifb commented Jun 26, 2021

comment:11

LGTM.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 26, 2021

comment:12

Thanks!

@tobiasdiez
Copy link
Contributor

comment:13
+    try:
+        import numpy
+        dirs.append(numpy.get_include())
+    except ModuleNotFoundError:
+        pass

Should this not better print an error message in case numpy is not found?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jun 26, 2021

comment:14

No, the whole point of this ticket is that it's not an error.

@vbraun
Copy link
Member

vbraun commented Jun 29, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants