enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.28k stars 282 forks source link

ImportError: Could not import backend for traitsui #1177

Closed hitbuyi closed 1 year ago

hitbuyi commented 1 year ago

Environments: OS: ubuntu20.04 conda: 4.13.0 mayavi: 4.7.4 vtk: 9.1.0 python:3.9.6

My virtual env's intalled packages are

(py1121) hitbuyi@hitbuyi-Dell-G15-5511:~/PycharmProjects/pytorch_project/3D_vis$ conda list
# packages in environment at /home/hitbuyi/.conda/envs/py1121:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
aiohttp                   3.8.3                    pypi_0    pypi
aiosignal                 1.2.0                    pypi_0    pypi
alabaster                 0.7.12                   pypi_0    pypi
apptools                  5.2.0                    pypi_0    pypi
async-timeout             4.0.2                    pypi_0    pypi
attrs                     22.1.0                   pypi_0    pypi
autobahn                  22.7.1                   pypi_0    pypi
automat                   20.2.0                   pypi_0    pypi
babel                     2.10.3                   pypi_0    pypi
ca-certificates           2022.07.19           h06a4308_0  
certifi                   2022.9.14        py39h06a4308_0  
cffi                      1.15.1                   pypi_0    pypi
charset-normalizer        2.1.1                    pypi_0    pypi
configobj                 5.0.6                    pypi_0    pypi
constantly                15.1.0                   pypi_0    pypi
contourpy                 1.0.5                    pypi_0    pypi
cryptography              38.0.1                   pypi_0    pypi
cycler                    0.11.0                   pypi_0    pypi
docutils                  0.19                     pypi_0    pypi
envisage                  6.1.0                    pypi_0    pypi
fonttools                 4.37.4                   pypi_0    pypi
frozenlist                1.3.1                    pypi_0    pypi
hyperlink                 21.0.0                   pypi_0    pypi
idna                      3.4                      pypi_0    pypi
imagesize                 1.4.1                    pypi_0    pypi
importlib-metadata        5.0.0                    pypi_0    pypi
incremental               21.3.0                   pypi_0    pypi
jinja2                    3.1.2                    pypi_0    pypi
kiwisolver                1.4.4                    pypi_0    pypi
ld_impl_linux-64          2.38                 h1181459_1  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 11.2.0               h1234567_1  
libgomp                   11.2.0               h1234567_1  
libstdcxx-ng              11.2.0               h1234567_1  
markupsafe                2.1.1                    pypi_0    pypi
matplotlib                3.6.0                    pypi_0    pypi
mayavi                    4.7.4                    pypi_0    pypi
multidict                 6.0.2                    pypi_0    pypi
ncurses                   6.3                  h5eee18b_3  
numpy                     1.23.3                   pypi_0    pypi
opencv-python             4.6.0.66                 pypi_0    pypi
openssl                   1.1.1q               h7f8727e_0  
packaging                 21.3                     pypi_0    pypi
pillow                    9.2.0                    pypi_0    pypi
pip                       22.2.2           py39h06a4308_0  
pycparser                 2.21                     pypi_0    pypi
pyface                    7.4.2                    pypi_0    pypi
pygments                  2.13.0                   pypi_0    pypi
pyparsing                 3.0.9                    pypi_0    pypi
pyqt5                     5.15.2                   pypi_0    pypi
pyqt5-qt5                 5.15.2                   pypi_0    pypi
pyqt5-sip                 12.11.0                  pypi_0    pypi
pyside6-addons            6.3.2                    pypi_0    pypi
pyside6-essentials        6.3.2                    pypi_0    pypi
python                    3.9.6                h12debd9_1  
python-dateutil           2.8.2                    pypi_0    pypi
pytz                      2022.4                   pypi_0    pypi
readline                  8.1.2                h7f8727e_1  
requests                  2.28.1                   pypi_0    pypi
scipy                     1.9.1                    pypi_0    pypi
setuptools                59.0.1                   pypi_0    pypi
shiboken6                 6.3.2                    pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
snowballstemmer           2.2.0                    pypi_0    pypi
sphinx                    5.2.3                    pypi_0    pypi
sphinxcontrib-applehelp   1.0.2                    pypi_0    pypi
sphinxcontrib-devhelp     1.0.2                    pypi_0    pypi
sphinxcontrib-htmlhelp    2.0.0                    pypi_0    pypi
sphinxcontrib-jsmath      1.0.1                    pypi_0    pypi
sphinxcontrib-qthelp      1.0.3                    pypi_0    pypi
sphinxcontrib-serializinghtml 1.1.5                    pypi_0    pypi
sqlite                    3.39.3               h5082296_0  
tk                        8.6.12               h1ccaba5_0  
traits                    6.4.1                    pypi_0    pypi
traitsui                  7.4.1                    pypi_0    pypi
twisted                   22.8.0                   pypi_0    pypi
txaio                     22.2.1                   pypi_0    pypi
typing-extensions         4.3.0                    pypi_0    pypi
tzdata                    2022c                h04d1e81_0  
urllib3                   1.26.12                  pypi_0    pypi
vtk                       9.1.0                    pypi_0    pypi
wheel                     0.37.1             pyhd3eb1b0_0  
wslink                    1.8.2                    pypi_0    pypi
xz                        5.2.6                h5eee18b_0  
yarl                      1.8.1                    pypi_0    pypi
zipp                      3.8.1                    pypi_0    pypi
zlib                      1.2.12               h5eee18b_3  
zope-interface            5.4.0                    pypi_0    pypi

Error reproducing

When I choose a example to run, error message comes as :

WARNING: Skipping pyside6 as it is not installed.
(py1121) hitbuyi@hitbuyi-Dell-G15-5511:~/PycharmProjects/pytorch_project/3D_vis$ python kitti_object.py --show_lidar_with_depth --img_fov --const_box --vis
data/object training
Traceback (most recent call last):
  File "/home/hitbuyi/PycharmProjects/pytorch_project/3D_vis/kitti_object.py", line 982, in <module>
    dataset_viz(args.dir, args)
  File "/home/hitbuyi/PycharmProjects/pytorch_project/3D_vis/kitti_object.py", line 744, in dataset_viz
    fig = mlab.figure(
  File "/home/hitbuyi/.conda/envs/py1121/lib/python3.9/site-packages/mayavi/tools/figure.py", line 64, in figure
    engine = get_engine()
  File "/home/hitbuyi/.conda/envs/py1121/lib/python3.9/site-packages/mayavi/tools/engine_manager.py", line 92, in get_engine
    return self.new_engine()
  File "/home/hitbuyi/.conda/envs/py1121/lib/python3.9/site-packages/mayavi/tools/engine_manager.py", line 137, in new_engine
    check_backend()
  File "/home/hitbuyi/.conda/envs/py1121/lib/python3.9/site-packages/mayavi/tools/engine_manager.py", line 40, in check_backend
    raise ImportError(msg)
ImportError: Could not import backend for traitsui.  Make sure you
        have a suitable UI toolkit like PyQt/PySide or wxPython
        installed.

What're the problems of mayavi?

hitbuyi commented 1 year ago

I have found that this was caused by mayavi finding the wrong UI toolkit, because I set some QT PATH variables in ~/.bahsrc, if I comment out this macros, it is solved.