enthought / mayavi

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

KeyError: 'traitsui.toolkits' #1221

Open zwl8979 opened 1 year ago

zwl8979 commented 1 year ago

Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/importlib_metadata/init.py", line 289, in getitem return next(iter(self.select(name=name))) StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ubuntu/zhangweili/DAIR-V2X-main/tools/visualize/vis_label_in_3d.py", line 3, in import mayavi.mlab as mlab File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/mayavi/mlab.py", line 16, in from mayavi.tools.camera import view, roll, yaw, pitch, move File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/mayavi/tools/camera.py", line 24, in from .engine_manager import get_engine File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/mayavi/tools/engine_manager.py", line 13, in from mayavi.preferences.api import preference_manager File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/mayavi/preferences/api.py", line 4, in from .preference_manager import preference_manager File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/mayavi/preferences/preference_manager.py", line 29, in from traitsui.api import View, Group, Item File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traitsui/api.py", line 256, in from .editors.api import ArrayEditor File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traitsui/editors/init.py", line 16, in from .api import ArrayEditor File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traitsui/editors/api.py", line 86, in from .code_editor import CodeEditor File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traitsui/editors/code_editor.py", line 21, in class CodeEditor(EditorFactory): File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traitsui/editors/code_editor.py", line 33, in CodeEditor mark_color = Color(0xECE9D8) File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traits/trait_factory.py", line 40, in call return self.maker_function(*args, *metadata) File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traitsui/toolkit_traits.py", line 43, in ColorTrait return toolkit().color_trait(args, **traits) File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/traitsui/toolkit.py", line 110, in toolkit _toolkit = find_toolkit("traitsui.toolkits") File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/pyface/base_toolkit.py", line 285, in find_toolkit plugin for plugin in importlib_metadata.entry_points()[entry_point] File "/home/ubuntu/anaconda3/envs/dair_v2x/lib/python3.7/site-packages/importlib_metadata/init.py", line 291, in getitem raise KeyError(name) KeyError: 'traitsui.toolkits' mayavi==4.8.1,traitsui==7.2.1, traits==6.2.0, traitlets==5.9.0, importlib_metadata==6.0.0, importlib_resources==5.12.0 What is the reason for this, and how to solve it? Thanks!

corranwebster commented 1 year ago

You need to have a backend GUI toolkit installed (PySide, PyQt, or WxPython). If you have one of these and it is not being automatically discovered (or you have multiple installed in the same environment), you may need to manually specify via the ETS_TOOLKIT environment variable.

See https://docs.enthought.com/pyface/toolkits.html for more information about ETS toolkits.

Edit to add: that page is a bit out-of-date - qt is preferred over qt4, althought qt4 should still work even with Qt5 or Qt6. See also https://docs.enthought.com/pyface/#toolkit-backends

zwl8979 commented 1 year ago

You need to have a backend GUI toolkit installed (PySide, PyQt, or WxPython). If you have one of these and it is not being automatically discovered (or you have multiple installed in the same environment), you may need to manually specify via the ETS_TOOLKIT environment variable.

See https://docs.enthought.com/pyface/toolkits.html for more information about ETS toolkits.

Edit to add: that page is a bit out-of-date - qt is preferred over qt4, althought qt4 should still work even with Qt5 or Qt6. See also https://docs.enthought.com/pyface/#toolkit-backends

Thank you for your positive suggestion. The following is the list of packages installed in my virtual environment, conda list used: 1.https://user-images.githubusercontent.com/96425538/227682401-97c218cc-5493-4517-b41d-b3484304fc83.png

  1. https://user-images.githubusercontent.com/96425538/227682464-a6751f1c-efc0-424d-94f4-3bfdee9a6a54.png 3.https://user-images.githubusercontent.com/96425538/227682301-be7c753a-5fea-4f4b-9120-a7833b1683ac.png pyqt5 is installed in the environment, and the following content is added to the .bashrc file in my linux system: https://user-images.githubusercontent.com/96425538/227682542-6e8d90e8-e2da-4bd0-bef6-dbd00ee75bc2.png problem not solved。
corranwebster commented 1 year ago

Your QT_API environment is likely the problem - it's asking for PyQt (ie Qt4 version) but you have Qt5 installed in your environment, so importing it will likely fail. Try removing pyqt and set the QT_API environment to pyqt5.

WangzcBruce commented 1 year ago

Hello, bro, have you fixed this problem? I met the same issue as follows: image

corranwebster commented 1 year ago

How is traitsui installed in your environment - it doesn't seem to be picking up the entrypoints for the backend toolkits?

WangzcBruce commented 1 year ago

I have installed the traitsui package. The following packages installed in the virtual environment are listed as follows (wzc) root@1d61b6b03fc4:~/DAIR-V2X# conda list

packages in environment at /opt/conda/envs/wzc:

#

Name Version Build Channel

_libgcc_mutex 0.1 main _openmp_mutex 5.1 1_gnu absl-py 1.4.0 pypi_0 pypi addict 2.4.0 pypi_0 pypi aiofiles 22.1.0 pypi_0 pypi aiosqlite 0.19.0 pypi_0 pypi anyio 3.6.2 pypi_0 pypi apptools 5.1.0 pyhd3eb1b0_0 argon2-cffi 21.3.0 pypi_0 pypi argon2-cffi-bindings 21.2.0 pypi_0 pypi arrow 1.2.3 pypi_0 pypi attrs 23.1.0 pypi_0 pypi babel 2.12.1 pypi_0 pypi backcall 0.2.0 pypi_0 pypi beautifulsoup4 4.12.2 pypi_0 pypi black 23.3.0 pypi_0 pypi blas 1.0 mkl bleach 6.0.0 pypi_0 pypi bzip2 1.0.8 h7b6447c_0 c-ares 1.19.0 h5eee18b_0 ca-certificates 2023.01.10 h06a4308_0 cached-property 1.5.2 pypi_0 pypi cachetools 5.3.0 pypi_0 pypi certifi 2022.12.7 py37h06a4308_0 cffi 1.15.1 pypi_0 pypi charset-normalizer 3.1.0 pypi_0 pypi click 8.1.3 pypi_0 pypi configobj 5.0.6 py37h06a4308_1 cudatoolkit 10.2.89 hfd86e86_1 curl 7.88.1 h5eee18b_0 cycler 0.11.0 pypi_0 pypi dbus 1.13.18 hb2f20db_0 debugpy 1.6.7 pypi_0 pypi decorator 5.1.1 pypi_0 pypi defusedxml 0.7.1 pypi_0 pypi deprecated 1.2.13 pypi_0 pypi deprecation 2.1.0 pypi_0 pypi descartes 1.1.0 pypi_0 pypi entrypoints 0.4 pypi_0 pypi envisage 6.0.1 pyhd3eb1b0_0 exceptiongroup 1.1.1 pypi_0 pypi expat 2.4.9 h6a678d5_0 fastjsonschema 2.16.3 pypi_0 pypi fire 0.5.0 pypi_0 pypi flake8 3.9.2 pypi_0 pypi fontconfig 2.14.1 h52c9d5c_1 fonttools 4.38.0 pypi_0 pypi fqdn 1.5.1 pypi_0 pypi freetype 2.12.1 h4a9f257_0 future 0.18.3 py37h06a4308_0 giflib 5.2.1 h5eee18b_3 glib 2.69.1 he621ea3_2 google-auth 2.18.0 pypi_0 pypi google-auth-oauthlib 0.4.6 pypi_0 pypi grpcio 1.54.0 pypi_0 pypi gst-plugins-base 1.14.1 h6a678d5_1 gstreamer 1.14.1 h5eee18b_1 hdf4 4.2.13 h3ca952b_2 hdf5 1.10.4 hb1b8bf9_0 icu 58.2 he6710b0_3 idna 3.4 pypi_0 pypi imageio 2.28.1 pypi_0 pypi importlib-metadata 6.6.0 pypi_0 pypi importlib-resources 5.12.0 pypi_0 pypi iniconfig 2.0.0 pypi_0 pypi intel-openmp 2021.4.0 h06a4308_3561 ipykernel 6.16.2 pypi_0 pypi ipython 7.34.0 pypi_0 pypi ipython-genutils 0.2.0 pypi_0 pypi ipywidgets 8.0.6 pypi_0 pypi isoduration 20.11.0 pypi_0 pypi jedi 0.18.2 pypi_0 pypi jinja2 3.1.2 pypi_0 pypi joblib 1.2.0 pypi_0 pypi jpeg 9e h5eee18b_1 json5 0.9.11 pypi_0 pypi jsoncpp 1.9.4 hff7bd54_2 jsonpointer 2.3 pypi_0 pypi jsonschema 4.17.3 pypi_0 pypi jupyter 1.0.0 pypi_0 pypi jupyter-client 7.4.9 pypi_0 pypi jupyter-console 6.6.3 pypi_0 pypi jupyter-core 4.12.0 pypi_0 pypi jupyter-events 0.6.3 pypi_0 pypi jupyter-packaging 0.12.3 pypi_0 pypi jupyter-server 1.24.0 pypi_0 pypi jupyter-server-fileid 0.9.0 pypi_0 pypi jupyter-server-ydoc 0.8.0 pypi_0 pypi jupyter-ydoc 0.2.4 pypi_0 pypi jupyterlab 3.6.3 pypi_0 pypi jupyterlab-pygments 0.2.2 pypi_0 pypi jupyterlab-server 2.22.1 pypi_0 pypi jupyterlab-widgets 3.0.7 pypi_0 pypi kiwisolver 1.4.4 pypi_0 pypi krb5 1.19.4 h568e23c_0 lcms2 2.12 h3be6417_0 ld_impl_linux-64 2.38 h1181459_1 lerc 3.0 h295c915_0 libcurl 7.88.1 h91b91d3_0 libdeflate 1.17 h5eee18b_0 libedit 3.1.20221030 h5eee18b_0 libev 4.33 h7f8727e_1 libffi 3.4.4 h6a678d5_0 libgcc-ng 11.2.0 h1234567_1 libgfortran-ng 7.5.0 ha8ba4b0_17 libgfortran4 7.5.0 ha8ba4b0_17 libgomp 11.2.0 h1234567_1 libnetcdf 4.6.1 h11d0813_2 libnghttp2 1.46.0 hce63b2e_0 libogg 1.3.5 h27cfd23_1 libpng 1.6.39 h5eee18b_0 libssh2 1.10.0 h8f2d780_0 libstdcxx-ng 11.2.0 h1234567_1 libtheora 1.1.1 h7f8727e_3 libtiff 4.1.0 h2733197_0 libuuid 1.41.5 h5eee18b_0 libuv 1.44.2 h5eee18b_0 libvorbis 1.3.7 h7b6447c_0 libwebp 1.2.4 h11a3e52_1 libwebp-base 1.2.4 h5eee18b_1 libxcb 1.15 h7f8727e_0 libxml2 2.9.14 h74e7548_0 llvmlite 0.31.0 pypi_0 pypi lyft-dataset-sdk 0.0.8 pypi_0 pypi lz4-c 1.8.1.2 h14c3975_0 markdown 3.4.3 pypi_0 pypi markupsafe 2.1.2 pypi_0 pypi matplotlib 3.5.2 pypi_0 pypi matplotlib-inline 0.1.6 pypi_0 pypi mayavi 4.7.1 py37h94891b3_2 mccabe 0.6.1 pypi_0 pypi mistune 2.0.5 pypi_0 pypi mkl 2021.4.0 h06a4308_640 mkl-service 2.4.0 py37h7f8727e_0 mkl_fft 1.3.1 py37hd3c417c_0 mkl_random 1.2.2 py37h51133e4_0 mmcv-full 1.3.8 pypi_0 pypi mmdet 2.14.0 pypi_0 pypi mmdet3d 0.17.1 dev_0 mmsegmentation 0.14.1 pypi_0 pypi mypy-extensions 1.0.0 pypi_0 pypi nbclassic 1.0.0 pypi_0 pypi nbclient 0.7.4 pypi_0 pypi nbconvert 7.4.0 pypi_0 pypi nbformat 5.8.0 pypi_0 pypi ncurses 6.4 h6a678d5_0 nest-asyncio 1.5.6 pypi_0 pypi networkx 2.2 pypi_0 pypi ninja 1.10.2 h06a4308_5 ninja-base 1.10.2 hd09550d_5 notebook 6.5.4 pypi_0 pypi notebook-shim 0.2.3 pypi_0 pypi numba 0.48.0 pypi_0 pypi numpy 1.19.5 pypi_0 pypi nuscenes-devkit 1.1.10 pypi_0 pypi oauthlib 3.2.2 pypi_0 pypi open3d 0.13.0 pypi_0 pypi opencv-python 4.7.0.72 pypi_0 pypi opencv-python-headless 4.7.0.72 pypi_0 pypi openssl 1.1.1t h7f8727e_0 packaging 23.1 pypi_0 pypi pandas 1.3.5 pypi_0 pypi pandocfilters 1.5.0 pypi_0 pypi parso 0.8.3 pypi_0 pypi pathspec 0.11.1 pypi_0 pypi pcre 8.45 h295c915_0 pexpect 4.8.0 pypi_0 pypi pickleshare 0.7.5 pypi_0 pypi pillow 9.3.0 py37hace64e9_1 pip 22.3.1 py37h06a4308_0 pkgutil-resolve-name 1.3.10 pypi_0 pypi platformdirs 3.5.1 pypi_0 pypi plotly 5.14.1 pypi_0 pypi pluggy 1.0.0 pypi_0 pypi plyfile 0.9 pypi_0 pypi prettytable 3.7.0 pypi_0 pypi prometheus-client 0.16.0 pypi_0 pypi prompt-toolkit 3.0.38 pypi_0 pypi protobuf 3.20.3 pypi_0 pypi psutil 5.9.5 pypi_0 pypi ptyprocess 0.7.0 pypi_0 pypi pyasn1 0.5.0 pypi_0 pypi pyasn1-modules 0.3.0 pypi_0 pypi pycocotools 2.0.6 pypi_0 pypi pycodestyle 2.7.0 pypi_0 pypi pycparser 2.21 pypi_0 pypi pyface 7.3.0 py37h06a4308_1 pyflakes 2.3.1 pypi_0 pypi pygments 2.15.1 pypi_0 pypi pyparsing 3.0.9 pypi_0 pypi pypcd 0.1.1 pypi_0 pypi pyqt 5.9.2 py37h05f1152_2 pyquaternion 0.9.9 pypi_0 pypi pyrsistent 0.19.3 pypi_0 pypi pytest 7.3.1 pypi_0 pypi python 3.7.16 h7a1cb2a_0 python-dateutil 2.8.2 pypi_0 pypi python-json-logger 2.0.7 pypi_0 pypi python-lzf 0.2.4 pypi_0 pypi pytorch 1.7.0 py3.7_cuda10.2.89_cudnn7.6.5_0 pytorch pytz 2023.3 pypi_0 pypi pywavelets 1.3.0 pypi_0 pypi pyyaml 6.0 pypi_0 pypi pyzmq 25.0.2 pypi_0 pypi qt 5.9.7 h5867ecd_1 qtconsole 5.4.3 pypi_0 pypi qtpy 2.3.1 pypi_0 pypi readline 8.2 h5eee18b_0 requests 2.30.0 pypi_0 pypi requests-oauthlib 1.3.1 pypi_0 pypi rfc3339-validator 0.1.4 pypi_0 pypi rfc3986-validator 0.1.1 pypi_0 pypi rsa 4.9 pypi_0 pypi scikit-image 0.19.3 pypi_0 pypi scikit-learn 1.0.2 pypi_0 pypi scipy 1.7.3 pypi_0 pypi send2trash 1.8.2 pypi_0 pypi setuptools 65.6.3 py37h06a4308_0 shapely 1.8.5 pypi_0 pypi sip 4.19.8 py37hf484d3e_0 six 1.16.0 pyhd3eb1b0_1 sniffio 1.3.0 pypi_0 pypi soupsieve 2.4.1 pypi_0 pypi sqlite 3.41.2 h5eee18b_0 tbb 2021.8.0 hdb19cb5_0 tenacity 8.2.2 pypi_0 pypi tensorboard 2.11.2 pypi_0 pypi tensorboard-data-server 0.6.1 pypi_0 pypi tensorboard-plugin-wit 1.8.1 pypi_0 pypi termcolor 2.3.0 pypi_0 pypi terminado 0.17.1 pypi_0 pypi terminaltables 3.1.10 pypi_0 pypi threadpoolctl 3.1.0 pypi_0 pypi tifffile 2021.11.2 pypi_0 pypi tinycss2 1.2.1 pypi_0 pypi tk 8.6.12 h1ccaba5_0 tomli 2.0.1 pypi_0 pypi tomlkit 0.11.8 pypi_0 pypi torchaudio 0.7.0 py37 pytorch torchvision 0.8.0 py37_cu102 pytorch tornado 6.2 pypi_0 pypi tqdm 4.65.0 pypi_0 pypi traitlets 5.9.0 pypi_0 pypi traits 6.2.0 py37h27cfd23_0 traitsui 7.2.1 pyhd3eb1b0_0 trimesh 2.35.39 pypi_0 pypi typed-ast 1.5.4 pypi_0 pypi typing-extensions 4.5.0 pypi_0 pypi uri-template 1.2.0 pypi_0 pypi urllib3 1.26.15 pypi_0 pypi vedo 2022.0.1 pypi_0 pypi vtk 8.2.0 py37haa4764d_200 wcwidth 0.2.6 pypi_0 pypi webcolors 1.13 pypi_0 pypi webencodings 0.5.1 pypi_0 pypi websocket-client 1.5.1 pypi_0 pypi werkzeug 2.2.3 pypi_0 pypi wheel 0.38.4 py37h06a4308_0 widgetsnbextension 4.0.7 pypi_0 pypi wrapt 1.15.0 pypi_0 pypi xz 5.4.2 h5eee18b_0 y-py 0.5.9 pypi_0 pypi yapf 0.33.0 pypi_0 pypi ypy-websocket 0.8.2 pypi_0 pypi zipp 3.15.0 pypi_0 pypi zlib 1.2.13 h5eee18b_0 zstd 1.3.7 h0b5b093_0

corranwebster commented 1 year ago

This may possibly be an issue with the conda package (which we don't control) - the immediate error you are seeing is because the toolkit entrypoints are not being discovered, which means that the appropriate package metadata isn't available - either because Conda didn't install it or something has replaced it.

The TraitsUI version is also fairly old, but that shouldn't be a cause of the problem. Similarly with Python 3.7 which is almost end-of-life.

I would suggest trying a re-install; you might also try using a different package manager - either venv and pip, or something like EDM

WangzcBruce commented 1 year ago

Thanks for your patience! I change the environment and another new problem happened (sad).

image

corranwebster commented 1 year ago

That's something even more fundamentally wrong with the install - you don't have a HOME environment variable set. Not sure what to suggest, as that's pretty fundamental for linux/unix environments.