viz.get_3d_backend() should return None if no 3d backend was found, instead of raising an exception
See original GitHub issueDescribe the problem
Currently, mne.viz.get_3d_backend() will raise a RuntimeError if no usable backend has been found:
Describe your solution
I believe it should return None instead: if there is currently no 3d backend, then, well, there is none 😉
Describe possible alternatives
I currently have to be ready to catch a RuntimeError when I simply want to query whether I can produce a 3d visualization or not. Background: I’m plotting STCs in environments that sometimes don’t have working pyvista or mayavi installations. I want to find out when that’s the case, and switch to using matplotlib instead.
Additional context
I checked how get_3d_backend() is currently used, and without exception, any use is a comparison likeif get_3d_backend() != 'pyvista':; therefore, returning None if no working backend was found should not break any existing code.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)

Top Related StackOverflow Question
I’ll open a PR to take care of it then 😃
That would be the idea, yes 😃