Importing mayavi from python creates pop-up with black background on UI (Mavericks/Canopy)

故事扮演 提交于 2019-12-06 15:55:49

问题


Image gallery: http://imgur.com/a/qZkTW#qGj7I0H

I just installed the new version of Canopy 1.3 from enthought. I opened up ipython, and I imported mayavi's mlab without issue. I then plotted a 3d sphere without issue using the following:

import mayavi
from mayavi import mlab
mlab.points3d(1,1,1)
mlab.show()

And I get what I would expect (See figure #2 in gallery). I can then open up the scene editor without issue (see figure #1 in gallery), but when I try to open any other traits editors for anything else, I get a weird black background with no text:

scalarscatter editor

This issue affects all other editors other than the scene editor. It has been reproduced after uninstalling canopy per the description on their website, restarting the computer and reinstalling canopy. It has persisted despite reinstallation with both 32- and 64-bit installations, and it also affects mayavi2 when run from the command line. I don't get this error when I open the Canopy.open an app and run everything from inside canopy, which is not really a viable option for my current workflow (I want to use ipython notebooks)

The only error I get via stderr seems to be unrelated:

Python[4434:d0f] CoreText performance note: Client called CTFontCreateWithName() using name ".Lucida Grande UI" and got font with PostScript name ".LucidaGrandeUI". For best performance, only use PostScript names when calling this API.
Python[4434:d0f] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.

I have updated all the canopy packages using the built-in installer. I'm using the built-in python for canopy. I never had any similar issues in the past with EPD, only since installing Canopy 1.3 on my computer.

I have searched the internet, and cannot find any other complaints of this issue. Please let me know if you have any ideas. I would really like to use the ipython notebook feature rather than opening Canopy.app every time.

Any help would be greatly appreciated!


回答1:


Several notes:

1) This should do it: ETS_TOOLKIT=qt4 ipython notebook --pylab qt (These settings are default within the Canopy app).

2) Be sure that you are starting Canopy User Python from Terminal. sys.prefix in terminal should be the same as from within Canopy's (i)Python shell. For details, see https://support.enthought.com/entries/23646538-Make-Canopy-User-Python-be-your-default-Python

3) FWIW, IPython notebook is useable directly within Canopy (File / New / IPython Notebook), but admittedly the experience is still not as good as in a regular browser, especially on Mac. By Canopy 1.4 or 1.5 we hope that it will be, so you can have the best of both worlds.



来源:https://stackoverflow.com/questions/22393103/importing-mayavi-from-python-creates-pop-up-with-black-background-on-ui-maveric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!