enthought / mayavi

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

Hello! When I use mayavi to visualize the point cloud, the following error appears: ImportError: Could not import backend for trainsui Make sure you have a suitable UI toolkit like PyQt/PySide or wxPython installed. #1197

Open Yuepengxin opened 1 year ago

Yuepengxin commented 1 year ago

Hello! My environment is ubuntu18.04, python 3.7.When I use mayavi to visualize the point cloud, the following error appears: ImportError: Could not import backend for trainsui Make sure you have a suitable UI toolkit like PyQt/PySide or wxPython installed. screenshot_69

But I have installed the required dependencies.

scre
![screenshot_65](https://user-images.githubusercontent.com/103159809/205288885-e3efd2b2-c8f8-4f42-bc79-75ae687fdfe4.png)
enshot_68 screenshot_67

I also defined the path of environment variables according to your suggestions to others:

screenshot_70

But this problem still exists. It's been bothering me for a long time. It's crazy. Could you help me?Thank you very much,sorry for your inconvenience.

JackDra commented 1 year ago

Make sure to also install a GUI library for mayavi to use.

Looks like you are using conda, so you can install pyqt4 or pyqt5 from conda into the environment

JackDra commented 1 year ago

https://anaconda.org/anaconda/pyqt

Yuepengxin commented 1 year ago

https://anaconda.org/anaconda/pyqt

Thank you for your reply. I executed the command "conda install - c anaconda pyqt". However, the results are still the same.

screenshot_71

screenshot_72

JackDra commented 1 year ago

I would try removing the 3 export lines at the bottom of the file you sent.

JackDra commented 1 year ago

Also make sure you install pyqt into the same environment you have your mayavi install in. Looks like the environment name you have is called pp, so make sure you install pyqt into that environment

Yuepengxin commented 1 year ago

Also make sure you install pyqt into the same environment you have your mayavi install in. Looks like the environment name you have is called pp, so make sure you install pyqt into that environment

Thank you for your reply.I have commented out the last three lines of the file.

screenshot_73

In addition, I have used the 'conda list' command to view the dependent packages in the current virtual environment. 'pyqt', 'pyqt5', and 'mayavi' all exist at the same time.

screenshot_74

screenshot_75

screenshot_76

However, the running results are the same and the same errors are reported. 图片

Yuepengxin commented 1 year ago

Also make sure you install pyqt into the same environment you have your mayavi install in. Looks like the environment name you have is called pp, so make sure you install pyqt into that environment

Thank you very much for your reply. I followed your last suggestion. I don't know if I understood it wrong, but I still haven't solved the problem. The questions and actions have been shown in screenshots. Is there a problem with my virtual environment? What environment and python version should mayavi need? This question has troubled me for a long time. Can you help me? Thank you very much.

JackDra commented 1 year ago

I would try installing it through pip (or pipenv) to see if its an issue with conda, your machine, or that build: https://github.com/enthought/mayavi#latest-stable-release

you could also try the "bleeding edge" install instructions: https://github.com/enthought/mayavi#bleeding-edge This one you might be able to install into your current conda environment.

You may also be able to set the ETS_TOOLKIT environment variable to something like PyQt6 https://github.com/enthought/traits/blob/67e096a18736ee3fcd8138fdb51dfcd184b2e072/traits/etsconfig/etsconfig.py#L464 I'm not sure exactly what value it needs to be set too.