Hi, I suspect this is really a python query, but I've been unable to fix it... An cluster upgrade has meant I have to submit all my yt scripts to the queue, rather than running interactively. For some reason, my script wants to pull up a window to show its plot and then panics because it can't find a display when it's submitted to a node. I don't understand why it wants to do this when I ask it to save, not show: from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import * . . . . stuff . . . pylab.plot(time, mass) pylab.ylim([6.39e9, 6.5e9]) pylab.savefig("mass_fig.png") I tried adding a "matplotlib.use('agg')" in there but to no avail. Elizabeth
Try making the first two lines of your code: import matplotlib matplotlib.use('Agg') I believe the caps on the 'Agg' matter. Cameron On 5/2/11 11:18 AM, Elizabeth Tasker wrote:
Hi,
I suspect this is really a python query, but I've been unable to fix it... An cluster upgrade has meant I have to submit all my yt scripts to the queue, rather than running interactively. For some reason, my script wants to pull up a window to show its plot and then panics because it can't find a display when it's submitted to a node. I don't understand why it wants to do this when I ask it to save, not show:
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import * .. .. .. .. stuff .. .. .. pylab.plot(time, mass) pylab.ylim([6.39e9, 6.5e9]) pylab.savefig("mass_fig.png")
I tried adding a "matplotlib.use('agg')" in there but to no avail.
Elizabeth
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Yup. I just wanted to add that the caps do indeed matter, and make
sure the matplotlib.use('Agg') comes *before* the import pylab
statement.
You can also select the backend on the command line:
python myscript.py -dAgg
should have the same effect. This makes matplotlib use the non-X11 Agg backend.
j
On Mon, May 2, 2011 at 8:24 AM, Cameron Hummels
Try making the first two lines of your code:
import matplotlib matplotlib.use('Agg')
I believe the caps on the 'Agg' matter.
Cameron
On 5/2/11 11:18 AM, Elizabeth Tasker wrote:
Hi,
I suspect this is really a python query, but I've been unable to fix it... An cluster upgrade has meant I have to submit all my yt scripts to the queue, rather than running interactively. For some reason, my script wants to pull up a window to show its plot and then panics because it can't find a display when it's submitted to a node. I don't understand why it wants to do this when I ask it to save, not show:
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import * .. .. .. .. stuff .. .. .. pylab.plot(time, mass) pylab.ylim([6.39e9, 6.5e9]) pylab.savefig("mass_fig.png")
I tried adding a "matplotlib.use('agg')" in there but to no avail.
Elizabeth
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
For some reason, it doesn't recognise this. Even though I have it right at the start of my script, I see: work/taskere/yt/yt-2/lib/python2.6/site-packages/matplotlib/__init__.py:854: UserWarning: This call to matplotlib.use() has no effect because the the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time. But it couldn't come any earlier: #!/usr/bin/python import matplotlib matplotlib.use('Agg') from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import * Elizabeth Cameron Hummels wrote:
Try making the first two lines of your code:
import matplotlib matplotlib.use('Agg')
I believe the caps on the 'Agg' matter.
Cameron
On 5/2/11 11:18 AM, Elizabeth Tasker wrote:
Hi,
I suspect this is really a python query, but I've been unable to fix it... An cluster upgrade has meant I have to submit all my yt scripts to the queue, rather than running interactively. For some reason, my script wants to pull up a window to show its plot and then panics because it can't find a display when it's submitted to a node. I don't understand why it wants to do this when I ask it to save, not show:
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import * .. .. .. .. stuff .. .. .. pylab.plot(time, mass) pylab.ylim([6.39e9, 6.5e9]) pylab.savefig("mass_fig.png")
I tried adding a "matplotlib.use('agg')" in there but to no avail.
Elizabeth
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Elizabeth,
If you're indeed running something as simple as:
mpirun -np 137 python dosomething.py
then can you try submitting a script *Without* the hashbang
/usr/bin/python at the top, and just including in it *only* the lines:
import matplotlib;matplotlib.use("Agg")
? If that fails, then I think it's something that is out of the realm
of yt and might be cause for discussion with the sysadmins.
Good luck,
Matt
On Mon, May 2, 2011 at 1:07 PM, Elizabeth Tasker
For some reason, it doesn't recognise this. Even though I have it right at the start of my script, I see:
work/taskere/yt/yt-2/lib/python2.6/site-packages/matplotlib/__init__.py:854: UserWarning: This call to matplotlib.use() has no effect because the the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time.
But it couldn't come any earlier:
#!/usr/bin/python
import matplotlib matplotlib.use('Agg')
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import *
Elizabeth
Cameron Hummels wrote:
Try making the first two lines of your code:
import matplotlib matplotlib.use('Agg')
I believe the caps on the 'Agg' matter.
Cameron
On 5/2/11 11:18 AM, Elizabeth Tasker wrote:
Hi,
I suspect this is really a python query, but I've been unable to fix it... An cluster upgrade has meant I have to submit all my yt scripts to the queue, rather than running interactively. For some reason, my script wants to pull up a window to show its plot and then panics because it can't find a display when it's submitted to a node. I don't understand why it wants to do this when I ask it to save, not show:
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import * .. .. .. .. stuff .. .. .. pylab.plot(time, mass) pylab.ylim([6.39e9, 6.5e9]) pylab.savefig("mass_fig.png")
I tried adding a "matplotlib.use('agg')" in there but to no avail.
Elizabeth
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Elizabeth,
It could be that your .matplotlibrc file is specifying another backend. I
think this called whenever you import matplotlib, which would be before you
do "backend: Agg
"
-Andrew
On Mon, May 2, 2011 at 1:07 PM, Elizabeth Tasker
For some reason, it doesn't recognise this. Even though I have it right at the start of my script, I see:
work/taskere/yt/yt-2/lib/python2.6/site-packages/matplotlib/__init__.py:854: UserWarning: This call to matplotlib.use() has no effect because the the backend has already been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time.
But it couldn't come any earlier:
#!/usr/bin/python
import matplotlib matplotlib.use('Agg')
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import *
Elizabeth
Cameron Hummels wrote:
Try making the first two lines of your code:
import matplotlib matplotlib.use('Agg')
I believe the caps on the 'Agg' matter.
Cameron
On 5/2/11 11:18 AM, Elizabeth Tasker wrote:
Hi,
I suspect this is really a python query, but I've been unable to fix it... An cluster upgrade has meant I have to submit all my yt scripts to the queue, rather than running interactively. For some reason, my script wants to pull up a window to show its plot and then panics because it can't find a display when it's submitted to a node. I don't understand why it wants to do this when I ask it to save, not show:
from yt.config import ytcfg; ytcfg["yt","serialize"] = "False" from yt.analysis_modules.api import EnzoSimulation as ES from yt.mods import * .. .. .. .. stuff .. .. .. pylab.plot(time, mass) pylab.ylim([6.39e9, 6.5e9]) pylab.savefig("mass_fig.png")
I tried adding a "matplotlib.use('agg')" in there but to no avail.
Elizabeth
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (5)
-
Andrew Myers
-
Cameron Hummels
-
Elizabeth Tasker
-
j s oishi
-
Matthew Turk