0

I'm using python 3.5 on windows, and following a tutorial about mayavi, which is using python 2.7, according to the previous experiences I have, version should not be a BIG obstacle, but turns out it is a BIG obstacle. Here's a simple test code:

import numpy as np
from mayavi import mlab
t = np.linspace(0, 4 * np.pi, 50)
x = np.sin(2 * t)
y = np.cos(t)
z = np.cos(2 * t)
s = 1 + np.sin(t)
mlab.points3d(x, y, z, s)  

And that's what I got(My folder name is erased)

Traceback (most recent call last):
  File "C:\...\PlotsPartOne.py", line 602, in <module>
    Main()
  File "C:\...\PlotsPartOne.py", line 590, in Main
    mayaviTest()
  File "C:\...\PlotsPartOne.py", line 582, in mayaviTest
    mlab.points3d(x, y, z, s)
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\helper_functions.py", line 37, in the_function
    return pipeline(*args, **kwargs)
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\helper_functions.py", line 77, in __call__
    scene = tools.gcf().scene
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\figure.py", line 113, in gcf
    engine = get_engine()
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\engine_manager.py", line 101, in get_engine
    return self.new_engine()
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\mayavi\tools\engine_manager.py", line 146, in new_engine
    check_backend()
  File "C:\Users\...\Anaconda3\lib\site-packages\mayavi-4.5.0-py3.5-win-amd64.egg\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 <pkg_name>. 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

And I am pretty sure that I have installed wxPython, traits and PyQt(version 5), but am not sure whether TraitsBackendWx or TraitsBackendQt is installed, I searched, and didn't find any package available for python 3... But sence mayavi has a python 3 version, there's got to be a way to run mayavi code on python 3(I suppose...) . So, any way to fix that?

2 Answers 2

3

TraitsBackendWx, TraitsBackendQt, Traits, TraitsGUI, Traits backend, wxPython or PyQT I don't lack any of these packages, what I need is a PySide package...

pip install PySide-1.2.4-cp35-cp35m-win_amd64.whl

The package (by a 3rd party, be warned) is located at https://github.com/krrr/PySide/releases/download/1.2.4-1/PySide-1.2.4-cp35-cp35m-win_amd64.whl.

Sign up to request clarification or add additional context in comments.

1 Comment

You are free to accept your own answer if it solved it for you.
0

I get it work in ubuntu by : sudo apt-get install python3-pyside

other modules related are : vtk 8.1.0 mayavi 4.5.0 python 3.5.2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.