Code Monkey home page Code Monkey logo

Comments (6)

christianbrodbeck avatar christianbrodbeck commented on September 23, 2024

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

from eelbrain.

dustinchacon avatar dustinchacon commented on September 23, 2024

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)```

from eelbrain.

christianbrodbeck avatar christianbrodbeck commented on September 23, 2024

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.

from eelbrain.

dustinchacon avatar dustinchacon commented on September 23, 2024

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

from eelbrain.

christianbrodbeck avatar christianbrodbeck commented on September 23, 2024

PySurfer PR (and branch) on which this should be fixed, in case you want to try: nipy/PySurfer#320

from eelbrain.

christianbrodbeck avatar christianbrodbeck commented on September 23, 2024

PySurfer is now updated to 0.11.1 which should fix this.

from eelbrain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.