run programme by python 3.10.0 in ubuntu 18.04, comes with 'cannot import name 'sequence' from 'collections

my system is ubuntu 18.04, when installing mne, now python is automatically installed version 3.10.0, however, it will lead the problem that cannot run the programme.
heres the code:

(mne) root@clifford-Alienware-15:~/Documents/dongyang/codes# python split_code_v3.py
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Traceback (most recent call last):
  File "/home/clifford/Documents/dongyang/codes/split_code_v3.py", line 10, in <module>
    from surfer import Brain
  File "/home/clifford/miniconda3/envs/mne/lib/python3.10/site-packages/surfer/__init__.py", line 1, in <module>
    from .viz import Brain, TimeViewer  # noqa
  File "/home/clifford/miniconda3/envs/mne/lib/python3.10/site-packages/surfer/viz.py", line 25, in <module>
    from . import utils, io
  File "/home/clifford/miniconda3/envs/mne/lib/python3.10/site-packages/surfer/utils.py", line 1, in <module>
    from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (/home/clifford/miniconda3/envs/mne/lib/python3.10/collections/__init__.py)

how to solve this ?

thanks for your answer!

pysurfer needs an update for 3.10

mne now recommends you use pyvista as 3D backend

ALex

Thanks, but how can I switch?

the code I used

from surfer import brain 

don’t know how to switch to pyvista

see https://mne.tools/stable/generated/mne.viz.set_3d_backend.html

HTH
Alex

so is it possible to switch

from surfer import brain

to

mne.viz.set_3d_backend(brain, verbose=None)

?

mne.viz.set_3d_backend(brain, verbose=None)
from mne.viz import Brain

this should work almost exactly as PySurfer

A

it comes with

name 'verbose' is not defined

however I import pyvista and pyvistaqt and mne

What if you try:

mne.set_3d_backend('pyvistaqt')
from mne.viz import Brain

?

Or even the following should work:

from mne.viz import get_brain_class
Brain = get_brain_class()
1 Like