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

ensure that numpy is not imported on startup #11714

Closed
williamstein opened this issue Aug 22, 2011 · 13 comments
Closed

ensure that numpy is not imported on startup #11714

williamstein opened this issue Aug 22, 2011 · 13 comments

Comments

@williamstein
Copy link
Contributor

This might or might not be worth it. Numpy is actually pretty fast these days (<.05 seconds), and the work needed to not import it is pretty scary. The attached patch causes all kinds of subtle trouble.


Apply only attachment: trac_11714-only-this.patch to the Sage library.

Component: misc

Keywords: sd32

Author: William Stein, Julian Rueth

Reviewer: William Stein

Merged: sage-4.7.2.alpha3

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

@williamstein

This comment has been minimized.

@williamstein
Copy link
Contributor Author

comment:1

Attachment: trac_11714.patch.gz

@williamstein
Copy link
Contributor Author

Changed keywords from none to sd32

@saraedum
Copy link
Member

Attachment: trac_11714_numpy_startup.patch.gz

use lazy imports to make sure numpy is not loaded on startup

@saraedum
Copy link
Member

comment:3

With the last patch numpy is not loaded in ./sage and ./sage --startuptime. Surprisingly this doctest fails, i.e., numpy is loaded in the doctests.

sage: import sys 
sage: 'numpy' in sys.modules 
False

I'll post something about the startup improvement once the full doctest run finished.

@williamstein
Copy link
Contributor Author

comment:4

This passes "make ptestlong" for me, except for the issue with 'numpy' in sys.modules.

I thought I posted how to fix this last night, but maybe there was a network problem. One solution is to use the Sage pexpect subprocess. I'm refreshing your patch with that.

@williamstein
Copy link
Contributor Author

fixes the import numpy issue. make ptestlong passes.

@williamstein
Copy link
Contributor Author

comment:5

Attachment: trac_11714-only-this.patch.gz

@nexttime
Copy link
Mannequin

nexttime mannequin commented Sep 8, 2011

Reviewer: William Stein

@nexttime
Copy link
Mannequin

nexttime mannequin commented Sep 8, 2011

comment:7

Please correct the authors / reviewers entries in case I missed or confused something.

@nexttime

This comment has been minimized.

@nexttime
Copy link
Mannequin

nexttime mannequin commented Sep 8, 2011

Author: William Stein, Julian Rueth

@nexttime
Copy link
Mannequin

nexttime mannequin commented Sep 13, 2011

Merged: sage-4.7.2.alpha3

@nexttime nexttime mannequin removed the s: positive review label Sep 13, 2011
@nexttime nexttime mannequin closed this as completed Sep 13, 2011
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

3 participants