Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Could not import backend for traits' with Pyqt4 and mac os 10.10.5 #460

Open
PennyQ opened this issue Nov 16, 2016 · 4 comments
Open

'Could not import backend for traits' with Pyqt4 and mac os 10.10.5 #460

PennyQ opened this issue Nov 16, 2016 · 4 comments

Comments

@PennyQ
Copy link

PennyQ commented Nov 16, 2016

So I tried many ways (pip, conda, easy_install, python setup develop source_code) to install mayavi, with pyqt4 and all other dependences (traits, traitsui, pyface, apptools, envisage) installed with conda, on mac os 10.10.5, but there is always an error that:

(mayavi2) ➜ mayavi git:(master) ✗ mayavi2
Traceback (most recent call last):
File "/Users/penny/anaconda/envs/mayavi2/bin/mayavi2", line 6, in
sys.exit(main())
File "/Users/penny/anaconda/envs/mayavi2/lib/python2.7/site-packages/mayavi/scripts/mayavi2.py", line 646, in main
'''
ImportError: Could not import backend for traits
Make sure that you have either the TraitsBackendWx or the TraitsBackendQt
projects installed. If you installed Mayavi with easy_install, try easy_install
<pkg_name>. easy_install Mayavi[app] will also work.

I tried to install TraitsBackendQt but there is no matching package on current osx-64 , any suggestions on making it work? Many thanks!

@corranwebster
Copy link
Member

To force a particular backend you can specify with with the ETS_TOOLKIT environment variable. Eg. at the commandline on unix the command ETS_TOOLKIT=qt4 mayavi will run Mayavi under qt4 with either the pyside or pyqt backend.

If that doesn't work, then you have some problem with your installation, and a clean install of mayavi and dependencies may be required. The Mayavi which comes with Enthought's free Canopy python environment is known to work.

@thomasaarholt
Copy link

@PennyQ Were you trying to plot in the Jupyter Notebook? I was running into this issue again and again as well. Turns out you have to run mlab.init_notebook() in the notebook, or %gui qt in the qtconsole.

@zangcc0474
Copy link

@thomasaarholt But after adding mlab.init_notebook(), it shows "Notebook initialized with x3d backend.". Where can I look at the graph?

@thomasaarholt
Copy link

@zangcc0474 "The graph"? You need to be way more specific when asking questions :)
mlab.init_notebook() is a setup command. It tells mlab that in order to plot anything, it needs to use the x3d software to plot. The message you get is confirmation that it has started correctly.

The following code should give you a inline, interactive plot when used in the notebook. It will likely be a bit slow. Please let me know if it works.

from mayavi import mlab
mlab.init_notebook()
mlab.test_contour3d()

The equivalent when run in the qtconsole, will be much faster:

from mayavi import mlab
%gui qt
mlab.test_contour3d()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants