9

OS: Linux Kubuntu 14.4.5

Python: Python 3.5.2 :: Continuum Analytics, Inc.


I tried to install Mayavi into my anaconda environment:

conda install -c menpo mayavi=4.5.0
conda install -c anaconda wxpython=3.0.0.0
conda install pyqt
conda install qt

But when I try to run the example from http://docs.enthought.com/mayavi/mayavi/auto/example_surface_from_irregular_data.html I get the error message

ImportError: Could not import backend for traits

with the explanation:

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

I searched the web and tried to find anything to setup, but couldn't find anything.

From http://docs.enthought.com/mayavi/mayavi/installation.html?highlight=installation I got that I could install it via pip with pip install mayavi, but that resulted only in the messages that "Requirement already satisfied", among which is

Requirement already satisfied: traits in /anaconda2/envs/myenv/lib/python3.5/site-packages (from mayavi)

What to do?

Make42
  • 12,236
  • 24
  • 79
  • 155

2 Answers2

2

The following steps worked for me (in a python2 environment):

conda create -yn mayavitest
source activate mayavitest
conda install -yc menpo mayavi=4.5.0
conda install -y pyside
conda install qt
ETS_TOOLKIT=qt4 python /path/to/mayavi-example.py

The installation of pyside might downgrade qt, that is why qt needs to be installed again.

Make42
  • 12,236
  • 24
  • 79
  • 155
Nehal J Wani
  • 16,071
  • 3
  • 64
  • 89
  • `conda install -y pyside` gives `specifications were found to be in conflict` - which is probably because I use Python 3.5. What to do? – Make42 Feb 01 '17 at 07:50
  • @Make42 Can you update your question with output for `conda info`? – Nehal J Wani Feb 01 '17 at 07:56
  • @Make42 In a new conda python 3 environment, I am able to run the example with just the packages installed as mentioned in the answer. Could you please try this in a separate environment and update if this works for you? – Nehal J Wani Feb 01 '17 at 07:58
  • I was able to install pyside with `conda install -c conda-forge pyside=1.2.4`. What is the last line `ETS_TOOLKIT=qt4 python /path/to/mayavi-example.py` good for? – Make42 Feb 01 '17 at 08:10
  • Also, now my reguar script says `ImportError: libQt5Core.so.5: Cannot open Shared-Object-File: file or directory not found." – Make42 Feb 01 '17 at 08:16
  • @Make42 ETS_TOOLKIT=qt4 sets the environment variable required for specifying the backend for traits. – Nehal J Wani Feb 01 '17 at 08:16
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/134559/discussion-between-make42-and-nehal-j-wani). – Make42 Feb 01 '17 at 08:26
0

Maybe OpenGL or any graphic card driver is missing. Because same error i got couple days ago was in windows server 2012 in hyper-v.

In windows you would used christopher gholke's windows wheels. In windows, again, you would need VC 2015 14.0 to compile traits libs. Maybe you need to dig what you need to install to compile traits libs.