Building a virtual environment for Mayavi dedicated to Python 3.6, Anaconda, Spyder users

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.

Channel problems when building a virtual environment

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)]

Solving problems related to axis display

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)]

[Reference site]

[1] https://conda.io/docs/commands/conda-create.html [2] https://github.com/enthought/mayavi/issues/474

Recommended Posts

Building a virtual environment for Mayavi dedicated to Python 3.6, Anaconda, Spyder users
[Mac] Building a virtual environment for Python
Building a Python virtual environment
Building a Python virtual environment
Building a Python environment for pyenv, pyenv-virtualenv, Anaconda (Miniconda)
Building a virtual environment with Python 3
[Python] Building a virtual python environment for the pyramid tutorial (summary)
Let's create a virtual environment for Python
[Python] Create a virtual environment with Anaconda
Building a conda environment for ROS users
Building a Python development environment for AI development
Add a Python virtual environment to VSCode
How about Anaconda for building a machine learning environment in Python?
From building a Python environment for inexperienced people to Hello world
From installing Ansible to building a Python environment in Vagrant's virtual environment
How to create a Python virtual environment (venv)
Building an Anaconda environment for Python with pyenv
Building a Python environment with WLS2 + Anaconda + PyCharm
[Python] Web development preparation (building a virtual environment)
From Python environment construction to virtual environment construction with anaconda
Notes from installing Homebrew to building an Anaconda environment for Python with pyenv
Write about building a Python environment for writing Qiita Qiita
Building a Docker working environment for R and Python
Building and enabling a python virtual environment, etc. (venv)
Procedure for building a CDK environment on Windows (Python)
Building a Python environment for programming beginners (Mac OS)
Memo for building a machine learning environment using Python
How to build a new python virtual environment on Ubuntu
Building a python environment for artificial intelligence (Chainer / TensorFlow / CSLAIER)
Summary from building Python 3.4. * From source to building a scientific computing environment
Building a development environment for Android apps-creating Android apps in Python
Building a Hy environment for Lisper who hasn't touched Python
How to develop in a virtual environment of Python [Memo]
Create a virtual environment for python on mac [Very easy]
Building a Python environment on Ubuntu
Create a virtual environment with Python!
The shortest memo for building a python environment that takes less than 5 minutes to work.
Building a Docker working environment for R and Python 2: Japanese support
Building a Windows 7 environment for getting started with machine learning with Python
Try using virtualenv, which can build a virtual environment for Python
Everything from building a Python environment to running it on Windows
A modern environment building procedure for those who want to get started with Python right away
Building a Python development environment on Windows -From installing Anaconda to linking Atom and Jupyter Notebook-
[Pyenv] Building a python environment with ubuntu 16.04
[Python] Building an environment with Anaconda [Mac]
Change Python 64bit environment to 32bit environment with Anaconda
Building a Python3 environment with Amazon Linux2
[5 steps] Apply anaconda virtual environment to VScode
Building a virtual environment using homebrew + pyenv-virtualenv
Building a Python 3.6 environment with Windows + PowerShell
I want to build a Python environment
Creating a python virtual environment on Windows
How to add python module to anaconda environment
Build a python virtual environment with pyenv
Creating a virtual environment in an Anaconda environment
Prepare a Python virtual environment for your project with venv with VS Code
Things to watch out for when creating a Python environment on a Mac
Steps to create a Python virtual environment with VS Code on Windows
Migration from Python2 to Python3 (Python2 is rebuilt as a virtual environment and coexists)
Try to set up a Vim test environment quite seriously (for Python)
Selenium + WebDriver (Chrome) + Python | Building environment for scraping