netneurolab / neuromaps

A toolbox for comparing brain maps
https://netneurolab.github.io/neuromaps
Other
246 stars 55 forks source link

[BUG] Issue with Nilearn compatability #149

Closed MIZwally closed 8 months ago

MIZwally commented 9 months ago

Issue summary

I am receiving an error indicating that some nilearn functions cannot be imported.

Detailed issue description

Specifically for _fetch_files(), I believe Nilearn has changed their repo structure in newer updates. The import from nilearn.datasets.utils import _fetch_files is now 'from nilearn.datasets._utils import fetch_files'. Specifying a version of nilearn in your requirements.txt file or updating the calls should fix the issue.

Steps to reproduce issue

>>> from neuromaps import datasets, images, nulls, resampling

Software version

3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0] 0.0.4

Code of Conduct

VinceBaz commented 9 months ago

Hi @MIZwally. This issue was fixed in our most recent release of neuromaps (0.0.5) :smile:

liuzhenqi77 commented 8 months ago

Close due to inactivity. Please feel free to reopen if issue persists.

LuuuXG commented 6 months ago

Hi @MIZwally. This issue was fixed in our most recent release of neuromaps (0.0.5) 😄

Hello Neuromaps development team. I met this issue with Neuromaps 0.0.5 and Nilearn 0.10.4 when referring the 'Parcellations' part in the user guide.

from netneurotools import datasets as nntdata

Traceback (most recent call last):
  File "E:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3444, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-4-14b6b8744890>", line 1, in <module>
    from netneurotools import datasets as nntdata
  File "D:\Program Files\JetBrains\PyCharm 2023.1.4\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "E:\Anaconda3\lib\site-packages\netneurotools\datasets\__init__.py", line 12, in <module>
    from .fetchers import (fetch_cammoun2012, fetch_pauli2018, fetch_fsaverage,
  File "D:\Program Files\JetBrains\PyCharm 2023.1.4\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "E:\Anaconda3\lib\site-packages\netneurotools\datasets\fetchers.py", line 12, in <module>
    from nilearn.datasets.utils import _fetch_files
ImportError: cannot import name '_fetch_files' from 'nilearn.datasets.utils' (E:\Anaconda3\lib\site-packages\nilearn\datasets\utils.py)

It was resolved after updating 'netneurotools'.

btw, in the documentation, the last line seems to be fc_grad_parc = parc.fit_transform(fc_grad, 'fsLR') rather than fc_grad_parc = parc.fit_transform(fcgradient, 'fsLR').

image