I'm trying to install and use mayavi in Mac OSX through homebrew and pip. I have installed python2, qt5, pyqt5 and vtk 7.1 through homebrew and changed path to make Homebrew python the default one. Then, when I try to install mayavi through pip. When i run mayavi2
in command line, I get the following error. I dont see a TraitsBackendWx
or TraitsBackendQt
in pip search
. How to resolve this error?
Traceback (most recent call last):
File "/usr/local/bin/mayavi2", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/mayavi/scripts/mayavi2.py", line 647, 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.
If you performed a source checkout, be sure to run 'python setup.py install'
in Traits, TraitsGUI, and the Traits backend of your choice.
Also make sure that either wxPython or PyQT is installed.
wxPython: http://www.wxpython.org/
PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro
Hi @rambalachandran, TraitsBackendWx
and TraitsBackendQt
are superseded by traitsui
and pyface
. Could you try to install traitsui
and pyface
please? And you might want to use qt4
and pyqt4
instead of Qt5.
Thank you. Can you please tell me how to install pyqt4? When I try pip install PyQt4
it throws me an error, although pip search PyQt4
shows that such a package exists
I installed all the relevant packages. I could not find PyQt4
or wxPython
in pip, so I installed PySide
. I have included the pip freeze as an attachment here. Even after that, when I try to run mayavi2
, I get the same error
Traceback (most recent call last):
File "/usr/local/bin/mayavi2", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/mayavi/scripts/mayavi2.py", line 647, 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.
If you performed a source checkout, be sure to run 'python setup.py install'
in Traits, TraitsGUI, and the Traits backend of your choice.
Also make sure that either wxPython or PyQT is installed.
wxPython: http://www.wxpython.org/
PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro
Installing wxpython
from homebrew solved the issue and the GUI for mayavi2 now opens.
@rambalachandran -- can we close this issue?
Does this mean I'm out of luck on OSX using python 3.6?
The mentioned package manager homebrew only has classic wxPython, which does not support python 3. pip actually abandoned this version and supplies the python 3 compatible "phoenix" version but mayavi is incompatible to this one.
pip3 does not have a PyQT4 distribution for OSX and PyQt5 is not supported (at least it is not picked up by traits, even though it imports successfully by hand)?
That's a quite uncomfortable situation.
@Argon- -- does this hold for the version from github or did you pip install it from pypi. The latest version should work with Qt5 but also requires more recent versions of traitsui/pyface which are not yet released. I'll ask about a new traitsui/pyface release supporting qt5 then I will also push a mayavi release.
I tried current master of pyface but was unaware that I also need a more recent traitsui (and mayavi). Are there any other dependencies I need to build locally?
In that case, I will try/test again (tomorrow) and report back.
Indeed the Qt5 backend does work perfectly! (well, with all the examples I tested ;) using both the mayavi program as well as ipython) Thanks for your hint!
When I was browsing the source code I found code for a Qt5 backend already committed months ago, so I somehow assumed this was released already, not noticing that the corresponding pip packages/releases are already ~1.5 years old.
To be more precise about my setup: I'm running OSX and have python 3.6, Qt5, VTK and PyQt installed using the package manager homebrew. I installed/built traitsui, pyface and mayavi at current git master using pip3. All the other dependencies were installed from pip3 in their regular release form.
So, as for this ticket, I guess it can be closed with the following verdict regarding backends on OSX:
Most helpful comment
Indeed the Qt5 backend does work perfectly! (well, with all the examples I tested ;) using both the mayavi program as well as ipython) Thanks for your hint!
When I was browsing the source code I found code for a Qt5 backend already committed months ago, so I somehow assumed this was released already, not noticing that the corresponding pip packages/releases are already ~1.5 years old.
To be more precise about my setup: I'm running OSX and have python 3.6, Qt5, VTK and PyQt installed using the package manager homebrew. I installed/built traitsui, pyface and mayavi at current git master using pip3. All the other dependencies were installed from pip3 in their regular release form.
So, as for this ticket, I guess it can be closed with the following verdict regarding backends on OSX: