Closed dustinchacon closed 1 year ago
The real issue is a problem occurs earlier, see the following line:
/Users/dac49596/anaconda3/envs/eelbrain0386/lib/python3.10/site-packages/eelbrain/plot/_brain_object.py:49: UserWarning: Error importing PySurfer: cannot import name 'Sequence' from 'collections' (/Users/dac49596/anaconda3/envs/eelbrain0386/lib/python3.10/collections/__init__.py)
This (admittedly vague) warning is issued when the following initialization fails:
from traits.trait_base import ETSConfig
if use_inline_backend() or not CONFIG['eelbrain']:
ETSConfig.toolkit = 'qt'
INLINE_DISPLAY = True
from mayavi import mlab
mlab.options.offscreen = True
else:
ETSConfig.toolkit = 'wx'
import surfer
What's strange is the actual error (cannot import name 'Sequence' from 'collections'
).
Can you try to run the following in your environment?
from traits.trait_base import ETSConfig
ETSConfig.toolkit = 'wx'
import surfer
Hi Christian,
Yes, I tried 'from surfer import Brain' and got the same error; I should have mentioned that as well.
I tried the code that you gave me. Unfortunately, I'm seeing the same thing:
(Thanks for the really fast response!!)
In [1]: from traits.trait_base import ETSConfig
In [2]: ETSConfig.toolkit = 'wx'
In [3]: import surfer
2023-05-04 20:01:05.067 python[30876:852374] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/mr/79qm2pcs3f76pkqdnd_pwfzml0x6yh/T/com.continuum.python.savedState
<frozen importlib._bootstrap>:241: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 96 from PyObject
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[3], line 1
----> 1 import surfer
File ~/anaconda3/envs/eelbrain0.38.4/lib/python3.10/site-packages/surfer/__init__.py:1
----> 1 from .viz import Brain, TimeViewer # noqa
2 from .utils import Surface, verbose, set_log_level, set_log_file # noqa
3 from .io import project_volume_data # noqa
File ~/anaconda3/envs/eelbrain0.38.4/lib/python3.10/site-packages/surfer/viz.py:25
22 from pyface.api import GUI
23 from traitsui.api import View, Item, Group, VGroup, HGroup, VSplit, HSplit
---> 25 from . import utils, io
26 from .utils import (Surface, verbose, create_color_lut, _get_subjects_dir,
27 string_types, threshold_filter, _check_units)
30 logger = logging.getLogger('surfer')
File ~/anaconda3/envs/eelbrain0.38.4/lib/python3.10/site-packages/surfer/utils.py:1
----> 1 from collections import Sequence
2 from distutils.version import LooseVersion
3 import logging
ImportError: cannot import name 'Sequence' from 'collections' (/Users/dac49596/anaconda3/envs/eelbrain0.38.4/lib/python3.10/collections/__init__.py)```
Looks like pysurfer is overdue for an update
This is from Python 3.9:
>>> from collections import Sequence
<ipython-input-6-8844d1891ca7>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import Sequence
For now, if you create an environment with Python 3.9 you should be able to proceed.
Ahhh, it didn't even occur to me to try other python versions.
Thanks so much for your help! I'll try it with python3.9 and report back
PySurfer PR (and branch) on which this should be fixed, in case you want to try: https://github.com/nipy/PySurfer/pull/320
PySurfer is now updated to 0.11.1 which should fix this.
Hi,
I'm trying to plot a cluster from a spatiotemporal cluster-based permutation test. Everything's working fine, until I try to use eelbrian.plot.brain.cluster, in which case I get an error saying that init() takes exactly one argument. I get this error if I just try to plot a brain using eelbrain.plot.brain.brain('fsaverage'), traceback below. I've had this issue with eelbrain 0.38.4 and 0.38.6, and I'm running this on Python 3.10 on Mac OS Monterey.
I've also tried to (re)install pysurfer. My MNE environment is able to render Brain objects fine in an ipython environment, and also in an eelbrain environment. So there's something happening specifically with eelbrain functions. Any ideas what's going on?