I 100% agree. This issue wasn't fixed at release time because it is delicate (we don't want matplotlib to be imported with SymPy but we do want it to be imported by the time plot() is called), and I didn't want to delay the release any further.
For matplotlib, we just need to modify how the plotting module works (see the issue page for some ideas). For numpy, there are three or four modules that import it, so they would all have to be fixed. The tricky thing, as I said, is that we have to move all the matplotlib/numpy imports inside function calls, rather than at the module level, so that they will not be done until someone uses the relevant functions for the first time. The issue is that if we forget to put it inside a particular function, it won't work (and given how low the test coverage is for the plotting module, this is quite likely to happen without us noticing). It also means that we can't do anything at import time that requires even knowing if matplotlib or numpy is installed. In particular, we can't set the plotting backend, meaning that code will probably need to be refactored so that if someone tries to look at the backend before plotting anything, it will not give an error, or a different backend than what will actually be used. Aaron Meurer On Tue, Jan 22, 2013 at 9:07 PM, Roberto Colistete Jr. <[email protected]> wrote: > Em 22-01-2013 22:23, Aaron Meurer escreveu: >> >> You'll need to do this first (before importing SymPy) because of a SymPy >> bug where importing SymPy imports matplotlib and already sets the backend >> (see http://code.google.com/p/sympy/issues/detail?id=3427). Aaron Meurer > > > About SymPy always loading MatPlotLib and NumPy, this behaviour isn't > desired in many cases. For example : > - see the benchmark of SymPy on Maemo/MeeGo Harmattan : > http://talk.maemo.org/showthread.php?t=78568 > time to load "from sympy import *" : 3.5s (v0.7.2), 2.4s (v0.7.2 without > MatPlotLib), 2.0s (v0.7.2 without PyLab), 1.7s (v0.7.1); > so even if the user doesn't need any plot, it takes 3.5s instead of 2.0s to > load if MatPlotLib and NumPy are installed; > - there are Integral, Derivative and Limit softwares for Maemo 5, if SymPy > 0.7.2 is used and MatPlotLib and NumPy are installed, the benchmark is for > "from sympy import *" : 8.0s (v0.7.2), 4.1s (v0.7.2 without MatPlotLib), > 3.5s (v0.7.2 without PyLab), 2.3s (v0.7.1). So, from 3.5s to 8.0s. > So I support the issue 3427 should be solved. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
