Opened 9 years ago

Closed 9 years ago

#11714 closed enhancement (fixed)

ensure that numpy is not imported on startup

Reported by: was Owned by: jason
Priority: minor Milestone: sage-4.7.2
Component: misc Keywords: sd32
Cc: Merged in: sage-4.7.2.alpha3
Authors: William Stein, Julian Rueth Reviewers: William Stein
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by leif)

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 trac_11714-only-this.patch to the Sage library.

Attachments (3)

trac_11714.patch (6.0 KB) - added by was 9 years ago.
trac_11714_numpy_startup.patch (8.2 KB) - added by saraedum 9 years ago.
use lazy imports to make sure numpy is not loaded on startup
trac_11714-only-this.patch (7.6 KB) - added by was 9 years ago.
fixes the import numpy issue. make ptestlong passes.

Download all attachments as: .zip

Change History (11)

Changed 9 years ago by was

comment:1 Changed 9 years ago by was

  • Description modified (diff)

comment:2 Changed 9 years ago by was

  • Keywords sd32 added

Changed 9 years ago by saraedum

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

comment:3 Changed 9 years ago by saraedum

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.

comment:4 Changed 9 years ago by was

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.

Changed 9 years ago by was

fixes the import numpy issue. make ptestlong passes.

comment:5 Changed 9 years ago by was

  • Status changed from new to needs_review

comment:6 Changed 9 years ago by was

  • Status changed from needs_review to positive_review

comment:7 Changed 9 years ago by leif

  • Authors set to William Stein, Julian Rueth
  • Description modified (diff)
  • Reviewers set to William Stein

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

comment:8 Changed 9 years ago by leif

  • Merged in set to sage-4.7.2.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.