Informatique / Python / Building Python 2.7.x/3.6.x with Mayavi 4.5.0 on Ubuntu 16.04
LTS
In this section I explain how to install Mayavi 4.5.1 (development version) for Python 3 on Ubuntu 17.10 by using
PyQt 5.
To use Mayavi 4.5.0 python package, the version 4 of PyQt is needed : version 5 is not supported in this
version of Mayavi. To use PyQt version 5 one has to install Mayavi 4.5.1 (development version on march 2018),
pyface (>= 5.2.0) and traitsui (>=5.2.0)
Firstly we install (as root) python3, python3-pip and python3-env Ubuntu packages. The last one will be
used to create Python virtual environments.
sudo apt-get install python3 python3-pip python3-venv
As first step, we create a virtual environment in /python-env/python3 directory
python3 -m venv ~/python-env/python3/Mayavi
We can now load this virtual environment :
source ~/python-env/python3/Mayavi/bin/activate
All the following commands will be execute in this environment. I have somme trouble when using pip3 for
installing some packages :
error: invalid command ’bdist_wheel’ ...
To avoid this trouble, I use the –no-cache-dir option. There are the command to install some usefull packages
(for me)
pip3 install numpy scipy matplotlib ipython3 --no-cache-dir
Then we classicaly install the VTK Python wrapper, PyQt version 5 and Mayavi 4.5.0
pip3 install VTK --no-cache-dirpip3 install pyQt5 --no-cache-dirpip3 install mayavi --no-cache-dir
And finally, one can upgrade the Mayavi pyface and traitsui from their git repository
pip3 install git+https://github.com/enthought/mayavi.gitpip3 install git+https://github.com/enthought/pyface.git
pip3 install git+https://github.com/enthought/traitsui.git
To quickly test the mayavi package, one can run the python code mayavi_boy.py (774 bytes) .
wget http://www.math.univ-paris13.fr/~cuvelier/docs/Informatique/Python/mayavi_boy.pypython3 mayavi_boy.py