Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importing mayavi.mlab results in error #875

Open
neramas1221 opened this issue Dec 21, 2019 · 11 comments
Open

importing mayavi.mlab results in error #875

neramas1221 opened this issue Dec 21, 2019 · 11 comments

Comments

@neramas1221
Copy link

When I try and use

import mayavi.mlab

I get the following issue:
No traitsui.toolkits plugin found for toolkit null

Does anyone know how to fix this?

Thank you

@corranwebster
Copy link

Most likely you do not have a GUI toolkit installed into your environment. You need to have one of PyQt, PySide2 or wxPython (version 3.x, currently) installed.

@neramas1221
Copy link
Author

I've installed both PyQt and PySide2 but I still get the error, i've checked my pip list and they are both installed. Do I need to set them somehow before importing?

@aconceicao
Copy link

I also have the same problem.

File "C:\Users\concea\AppData\Local\Continuum\anaconda3\Scripts\mayavi2-script.py", line 6, in
from mayavi.scripts.mayavi2 import main
File "C:\Users\concea\AppData\Local\Continuum\anaconda3\lib\site-packages\mayavi\scripts\mayavi2.py", line 427, in
runtests.main()
File "C:\Users\concea\AppData\Local\Continuum\anaconda3\lib\site-packages\mayavi\tests\runtests.py", line 225, in main
status = m2_tests(verbose)
File "C:\Users\concea\AppData\Local\Continuum\anaconda3\lib\site-packages\mayavi\tests\runtests.py", line 179, in m2_tests
err = run(tests, verbose)
File "C:\Users\concea\AppData\Local\Continuum\anaconda3\lib\site-packages\mayavi\tests\runtests.py", line 124, in run
res = re.search('Ran\s*(\d*)\s*test', err)
File "C:\Users\concea\AppData\Local\Continuum\anaconda3\lib\re.py", line 183, in search
return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object

Could anyone suggest me how to solve it? I have installed both pyqt and VTK

@mdickinson
Copy link
Member

@aconceicao The traceback you show looks unrelated to the toolkit error the OP was reporting. There's a separate issue here, which is that the runtests test runner hasn't been fully updated to work with Python 3.

@Huzaifg
Copy link

Huzaifg commented Sep 30, 2020

RuntimeError: No traitsui.toolkits plugin found for toolkit null

Same error. I have PyQt5 installed
On pip3 show PyQt5

Name: PyQt5
Version: 5.15.1
Summary: Python bindings for the Qt cross platform application toolkit
Home-page: https://www.riverbankcomputing.com/software/pyqt/
Author: Riverbank Computing Limited
Author-email: info@riverbankcomputing.com
License: GPL v3
Location: /home/huzaifa/env/lib/python3.8/site-packages
Requires: PyQt5-sip
Required-by: 

Also, typing mayavi2 in the cmd opens the GUI

@mdickinson
Copy link
Member

@Huzaifg Thanks for the report. It would be really helpful if you could show the complete traceback, and give system information and provide exact instructions to reproduce.

@Huzaifg
Copy link

Huzaifg commented Sep 30, 2020

Hey @mdickinson!
Here is the complete traceback

Exception in Tkinter callback
Traceback (most recent call last):
  File "tkinter/__init__.py", line 1883, in __call__
  File "arai.py", line 19, in plot
    from mayavi import mlab
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "mayavi/mlab.py", line 16, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "mayavi/tools/camera.py", line 24, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "mayavi/tools/engine_manager.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "mayavi/preferences/api.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "mayavi/preferences/preference_manager.py", line 29, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "traitsui/api.py", line 32, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "traitsui/editors/__init__.py", line 22, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "traitsui/editors/api.py", line 24, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/home/huzaifa/env/lib/python3.8/site-packages/PyInstaller/loader/pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "traitsui/editors/code_editor.py", line 34, in <module>
  File "traitsui/editors/code_editor.py", line 46, in ToolkitEditorFactory
  File "traits/trait_factory.py", line 40, in __call__
  File "traitsui/toolkit_traits.py", line 43, in ColorTrait
  File "traitsui/toolkit.py", line 113, in toolkit
  File "pyface/base_toolkit.py", line 288, in find_toolkit
  File "pyface/base_toolkit.py", line 215, in import_toolkit
RuntimeError: No traitsui.toolkits plugin found for toolkit null

I am building an executable using Pyinstaller which uses mayavi. I have created a virtual environment using virtualenv with all the required modules installed. Mayavi opens in the virtual environment and from mayavi import mlab also runs in the environment. But when I build the executable and test it, I get this error.

@mdickinson
Copy link
Member

Ah, PyInstaller. In that case the problem is likely related to enthought/pyface#350.

@dorkama
Copy link

dorkama commented Oct 5, 2020

I have the same problem but am not using pyinstaller.
Also, this problem only occurs when I import mlab on debug mode in pycharm (doesn't happen in a regular run, not sure what's the difference)

@mdickinson
Copy link
Member

mdickinson commented Oct 5, 2020

@dorkama Thanks for the report. Can you provide more information about exactly what you did, what operating system you're using, what versions of Python, Mayavi, VTK and other packages you're using, where you got them from, and exactly what results you got (including any relevant tracebacks)? We'd be happy to help, but there are many variables here and it's hard to diagnose or reproduce your issue without more information.

@simulatio
Copy link

Happens also in VS code debug mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants