question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not load any valid backend / no '_Rendered' object with forward operator

See original GitHub issue

Describe the bug

I’m trying to simulate EEG data, for which I need to compute the forward operator with fsaverage. This however produced the following error:

RuntimeError: Could not load any valid 3D backend: ['mayavi', 'pyvista']

I then successfully installed pyvista manually, but installing mayavi generated a large error log. If I now try to compute the forward operator, I keep getting the following error: AttributeError: 'NoneType' object has no attribute '_Renderer'

Steps to reproduce

I copied the MNE tutorial, as such:

import os.path as op

import mne
from mne.datasets import eegbci
from mne.datasets import fetch_fsaverage

# Download fsaverage files
fs_dir = fetch_fsaverage(verbose=True)
subjects_dir = op.dirname(fs_dir)

# The files live in:
subject = 'fsaverage'
trans = 'fsaverage'  # MNE has a built-in fsaverage transformation
src = op.join(fs_dir, 'bem', 'fsaverage-ico-5-src.fif')
bem = op.join(fs_dir, 'bem', 'fsaverage-5120-5120-5120-bem-sol.fif')

raw_fname, = eegbci.load_data(subject=1, runs=[6])
raw = mne.io.read_raw_edf(raw_fname, preload=True)

# Clean channel names to be able to use a standard 1005 montage
new_names = dict(
    (ch_name,
     ch_name.rstrip('.').upper().replace('Z', 'z').replace('FP', 'Fp'))
    for ch_name in raw.ch_names)
raw.rename_channels(new_names)

# Read and set the EEG electrode locations
montage = mne.channels.make_standard_montage('standard_1005')

raw.set_montage(montage)
raw.set_eeg_reference(projection=True)  # needed for inverse modeling

# Check that the locations of EEG electrodes is correct with respect to MRI
mne.viz.plot_alignment(
    raw.info, src=src, eeg=['original', 'projected'], trans=trans,
    show_axes=True, mri_fiducials=True, dig='fiducials')

Expected results

I was expecting a plot and a base to compute the forward operator.

Actual results

EDF file detected
Setting channel info structure...
Creating raw.info structure...
Reading 0 ... 19999  =      0.000 ...   124.994 secs...
Adding average EEG reference projection.
1 projection items deactivated
Average reference projection was added, but has not been applied yet. Use the apply_proj method to apply it.
Reading /Users/[USER]/mne_data/MNE-fsaverage-data/fsaverage/bem/fsaverage-ico-5-src.fif...
Using outer_skin.surf for head surface.

<ipython-input-30-c1141462bfd6> in <module>
     18 mne.viz.plot_alignment(
     19     raw.info, src=src, eeg=['original', 'projected'], trans=trans,
---> 20     show_axes=True, mri_fiducials=True, dig='fiducials')

<decorator-gen-128> in plot_alignment(info, trans, subject, subjects_dir, surfaces, coord_frame, meg, eeg, fwd, dig, ecog, src, mri_fiducials, bem, seeg, fnirs, show_axes, fig, interaction, verbose)

~/anaconda3/envs/opencv/lib/python3.7/site-packages/mne/viz/_3d.py in plot_alignment(***failed resolving arguments***)
   1034 
   1035     # initialize figure
-> 1036     renderer = _get_renderer(fig, bgcolor=(0.5, 0.5, 0.5), size=(800, 800))
   1037     if interaction == 'terrain':
   1038         renderer.set_interactive()

~/anaconda3/envs/opencv/lib/python3.7/site-packages/mne/viz/backends/renderer.py in _get_renderer(*args, **kwargs)
     31 def _get_renderer(*args, **kwargs):
     32     set_3d_backend(get_3d_backend(), verbose=False)
---> 33     return backend._Renderer(*args, **kwargs)
     34 
     35 

AttributeError: 'NoneType' object has no attribute '_Renderer'

Additional information

Platform:      Darwin-19.4.0-x86_64-i386-64bit
Python:        3.7.7 (default, Mar 26 2020, 10:32:53)  [Clang 4.0.1 (tags/RELEASE_401/final)]
Executable:    /Users/[USER]/anaconda3/envs/opencv/bin/python
CPU:           i386: 4 cores
Memory:        Unavailable (requires "psutil" package)
mne:           0.20.0
numpy:         1.18.1 {blas=mkl_rt, lapack=mkl_rt}
scipy:         1.4.1
matplotlib:    3.2.1 {backend=module://ipykernel.pylab.backend_inline}

sklearn:       0.22.1
numba:         Not found
nibabel:       Not found
cupy:          Not found
pandas:        1.0.3
dipy:          Not found
mayavi:        Not found
pyvista:       0.24.1
vtk:           8.1.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
GuillaumeFaveliercommented, Apr 14, 2020

Thanks for the quick response.

Perhaps the backend had to be set just once.

I think so.

Feel free to close if everything works for you now 👍

1reaction
DanielvdCcommented, Apr 14, 2020

After restarting my session the code actually works without the snippet as well. Perhaps the backend had to be set just once.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Render <a> with Optional href in React | Pluralsight
Consider data received from the backend, and based on that, a toggling state is set to either true or false. If it's true,...
Read more >
How to use EJS to template your Node.js application
We can do that by passing a second argument to res.render . This second argument must be an object, which will be accessible...
Read more >
Error Messages - SQLAlchemy 1.4 Documentation
Object cannot be converted to 'persistent' state, as this identity map is no longer valid. AsyncIO Exceptions. AwaitRequired; MissingGreenlet; No Inspection ...
Read more >
Django Tutorial Part 9: Working with forms - MDN Web Docs
In this tutorial, we'll show you how to work with HTML Forms in Django, ... Once the server gets a request with all...
Read more >
Handle errors in ASP.NET Core Blazor apps - Microsoft Learn
Rendering logic can throw an exception. An example of this scenario occurs when @someObject. PropertyName is evaluated but @someObject is null .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found