Mac OS X matplotlib WX backend

I've just installed yt on an Intel Mac and am trying to follow the examples for time series plots with iyt. When the pylab.plot statement is executed, the python plot window appears and python hangs (spinning beachball cursor). If I wait long enough a plot eventually shows up but python is still hung. This appears to be a known problem with the Enthought python distribution. (See https://svn.enthought.com/epd/ticket/186 .) I have verified that I get the same behavior using ordinary ipython rather than iyt. Happily there is also a known solution for ipython: simply invoke ipython with the -whtread option. I have tried this and it solves the problem--- in ipython. My question now is how to do the same thing for iyt. Is there a build option somewhere, so that iyt will start ipython with the -wthread flag?

Thomas,
My question now is how to do the same thing for iyt. Is there a build option somewhere, so that iyt will start ipython with the -wthread flag?
iyt is just a shell script: #!/path/to/yt/bin/python # EASY-INSTALL-SCRIPT: 'yt==1.5dev','iyt' __requires__ = 'yt==1.5dev' import pkg_resources pkg_resources.run_script('yt==1.5dev', 'iyt') Can you try changing the first line to /path/to/yt/bin/ipython -wthread and see if that works? _______________________________________________________ sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________

Hi Stephen, What you've quoted is actually kind of installation dependent, which is unfortunate and needs to be fixed. Setuptools, which we currently use to construct a few entry points, sometimes does magic to get around installing the actual scripts. The line: "pkg_resources.run_script('yt==1.5dev', 'iyt')" was automatically generated *by* setuptools to run iyt, which lives inside the scripts/ directory in the repository. 'iyt' itself does the instantiation of the IPython shell, which handles the threading. Changing the execution mechanism of the setuptools generated script will only change it until the next install, and I think we can provide, instead, a long-term fix by changing how IPython is instantiated. 'iyt' is where everything happens. Sigh, 'iyt' is something that should *just work*. I am embarrassed that it does not. I'll look into this, but I believe my previous fix will be a workable one. -Matt PS As a sidenote, we need to get rid of setuptools. We've had a ticket for a little while: http://yt.enzotools.org/ticket/175 to do this. Setuptools just adds too much magic and we don't get enough back from it. On Tue, Mar 3, 2009 at 10:05 AM, Stephen Skory <stephenskory@yahoo.com> wrote:
Thomas,
My question now is how to do the same thing for iyt. Is there a build option somewhere, so that iyt will start ipython with the -wthread flag?
iyt is just a shell script:
#!/path/to/yt/bin/python # EASY-INSTALL-SCRIPT: 'yt==1.5dev','iyt' __requires__ = 'yt==1.5dev' import pkg_resources pkg_resources.run_script('yt==1.5dev', 'iyt')
Can you try changing the first line to /path/to/yt/bin/ipython -wthread and see if that works?
_______________________________________________________ sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________ _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

Hi there,
This appears to be a known problem with the Enthought python distribution. (See https://svn.enthought.com/epd/ticket/186 .) I have verified that I get the same behavior using ordinary ipython rather than iyt. Happily there is also a known solution for ipython: simply invoke ipython with the -whtread option. I have tried this and it solves the problem--- in ipython.
My question now is how to do the same thing for iyt. Is there a build option somewhere, so that iyt will start ipython with the -wthread flag?
Oh, yikes, thank you for bringing this to our attention and tracking down the source. You're completely right, and the bug is definitely on the yt end. I think the source of the error is the way we're embedding the Matplotlib-based IPython interpreter. It looks like (in scripts/iyt: http://yt.enzotools.org/browser/trunk/scripts/iyt/#L21 ) we're initializing: IPython.Shell.IPShellMatplotlib but I think what we *ought* to be doing is initializing: IPython.Shell.IPShellMatplotlibWX if we're doing interactive work. I was able to replicate the beachball error you mention, and this change has fixed it for me. I believe the original decision to go with the former was made under the assumption that IPython knew how to choose the appropriate backend engine; this may have been in error. I believe currently most users only use 'wx' and not, for instance, 'tk' or 'Qt' so this should be okay. I'll do some research and possibly contact the IPython developers for more information, but if you make that change (I have included a diff below, for usage with 'patch -p1' inside the yt directory) and then re-run either "python setup.py install" or "python setup.py develop" (depending on how it was installed originally) it should propagate that change, and 'iyt' should work. I'll report back once I have more information, and if/when this change gets committed to the source repository. Thanks very much for tracking this down! -Matt

I'll report back once I have more information, and if/when this change gets committed to the source repository.
Hi everyone, sorry for the mail flood. The bug is mine, and I have found out where my confusion came from. Thomas is completely correct, we have not been doign the threading properly -- in fact, we were *explicitly* using a single-threaded matplotlib shell. I've fixed it by applying the patch above to both yt-1.0 and trunk; this is in r1195. (You can see the supporting information by doing: "import IPython.Shell; help(IPython.Shell)" where the various threading models are discussed.) Thanks again, -Matt
participants (3)
-
Matthew Turk
-
Stephen Skory
-
Thomas Statler