How to install Mayavi, a library specializing in 3D drawing, under the environment of Python 3.6, Anaconda (Python 3.x), Spyder.
Mayavi requires an older version of PyQt4, and it seems quick to build a Python 2.7 virtual environment to keep it consistent (?).
conda create -n py27mayavi python=2.7 pyqt=4 mayavi vtk spyder
Only the minimum libraries required for mayavi are listed here. In addition, please add necessary libraries as appropriate.
After that, I had a problem that Spyder for Mayavi did not start, but I solved it by changing the channel from conda-forge to Anaconda. Below are the successful virtual environment settings.
conda create -n maya27 python=2.7 anaconda spyder mayavi pyqt=4 qt=4 vtk=6 matplotlib=1 --override-channels --channel anaconda
The last `` `-override-channels --channel anaconda``` seems to be a miso [1]. Since ver = 1 of matplotlib keeps consistency with PyQt (probably), it may not be necessary to specify ver of vtk.
Don't forget `` -override-channels --channel anaconda``` when adding libraries to this virtual environment (it may be faster to reset the preferred channel from conda-forge to Anaconda anymore).
Also, since it is basically a stance of "just move", we have not investigated the cause. Please forgive me. .. [Addition so far (2018.07.18)]
For some reason, an error occurs when I try to set the axis scale, and the kernel dies. This seems to be a bug of mayavi ver4.5.0 or later [2]. The solution is as follows.
Step 1 Go to "(Anaconda folder path) / envs / (virtual environment name) / Lib / site-packages / mayavi"
Step 2 Line 173 of "axes.py" in the "modules" folder
self.configure_input_data(self.axes, src.outputs[0])
To
data = src.outputs[0] if not hasattr(src.outputs[0], 'output') else src.outputs[0].output
self.configure_input_data(self.axes, data)
Changed to.
Step 3 Line 372 of "decorations.py" in the "tools" folder
axes.axes.ranges = axes.module_manager.source.outputs[0].bounds
To
src = axes.module_manager.source
data = src.outputs[0] if not hasattr(src.outputs[0], 'output') else src.outputs[0].output
axes.axes.ranges = data.bounds
Changed to.
I just translated the last part of the reference site [2] ... In my environment, this is the solution and it's working fine so far. Setting is quite troublesome, but the 3D plot drawn with Mayavi is still beautiful. [Additional note 2 (2018.07.18)]
[1] https://conda.io/docs/commands/conda-create.html [2] https://github.com/enthought/mayavi/issues/474
Recommended Posts