I have been using matplotlib to plot 3D graphs, however I have found that matplotlib does not have a drag and rotate function for the plotted 3D graphs. I would like to install mayAVI that will enable me to do so, however I can't find any foolproof methods to install it. Could anyone guide me in the installation process? I do not use virtual environments.
MacOS – How to install mayAVI for the python3 on macOS Sierra
macospython
Related Question
- MacOS – Clean install of macOS Sierra not working
- MacOS – iCloud Drive Documents Folder Not Syncing After High Sierra New Install
- MacOS – iMac says that macOS High Sierra is installed but is still running Mavericks
- MacOS High Sierra python3 / pip awscli install path confusion
- MacOS – Terminal command to force-install Mac OS High Sierra onto a specified drive
- MacOS – Install csrutil or new recovery partion on High Sierra volume
Best Answer
I recently experienced your exact same problem (wanting to use MayaVi instead of matplotlib for 3D graphs and animations, not wanting to use virtual environments, and wanting to use MayaVi with python3). These are the direct steps I followed to start using MayaVi on my macOS Sierra 10.12.5.
(1) brew install vtk --with-python3 --without-python
(2) pip3 install mayavi
Next I tried running the script from http://docs.enthought.com/mayavi/mayavi/auto/example_mlab_visual.html#example-mlab-visual to see if it would run. I took that script exactly as found, added #!/usr/bin/env python3 and ran it as ./test.py. This resulted in:
======
Traceback (most recent call last): File "./test.py", line 6, in f = mlab.figure(size=(500,500)) File "/usr/local/lib/python3.6/site-packages/mayavi/tools/figure.py", line 63, in figure engine = get_engine() File "/usr/local/lib/python3.6/site-packages/mayavi/tools/engine_manager.py", line 101, in get_engine return self.new_engine() File "/usr/local/lib/python3.6/site-packages/mayavi/tools/engine_manager.py", line 146, in new_engine check_backend() File "/usr/local/lib/python3.6/site-packages/mayavi/tools/engine_manager.py", line 49, in check_backend ''') 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 . 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`
=====
So after googling the above problem I came across a github issue page that said to install the following items:
(3) brew install wxpython
(4) pip3 install traitsui (this was already installed on my machine)
Next, needing to install PyQt, so I followed the directions from a stack overflow question:
(5) brew tap cartr/qt4
(6) brew tap-pin cartr/qt4
(7) brew install qt
(8) brew install pyside
Now I tried running the script again. This time it ran, but I got the error:
So I changed the import line and modified some of the lines where the boxes are made:
And I can successfully run the script!