Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error during fetch_annotation #185

Open
1 task done
tincala91 opened this issue Dec 9, 2024 · 2 comments
Open
1 task done

[BUG] Error during fetch_annotation #185

tincala91 opened this issue Dec 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@tincala91
Copy link

Issue summary

Cannot download any annotation due to path error: str object has no attribute mkdir, triggered in nilearn's fetch_single_file.

Apparently in version 0.11.0 of nilearn, they require a Path object for data_dir, while in fetch_annotation.py, l288 the data dir is casted to string.

Removing the str(data_dir) fixes issue, but it will be incompatible with older nilearn.

Detailed issue description

No response

Steps to reproduce issue

pip install -U nilearn=0.11.0

from pathlib import Path
p = Path(r'C:/Users/asala/neuromaps-data')

from neuromaps.datasets import fetch_annotation
from neuromaps.datasets import available_annotations
for annotation in available_annotations(tags='PET'):
    print(annotation)
    fetch_annotation(source=annotation[0], desc=annotation[1],
                     space=annotation[2], den=annotation[3],
                     data_dir=p)

Software version

No response

Code of Conduct

  • I agree to follow the neuromaps Code of Conduct
@liuzhenqi77
Copy link
Member

Hi, thanks so much for reporting and pinpointing the bug! I've opened a PR for this.

Removing the str() works for me for both 0.11.0 and 0.10.X versions. May I ask which older nilearn version would be incompatible on your end? Thanks!

@tincala91
Copy link
Author

I checked with nilearn 0.10.4, and it accepts the string object instead of path, and use the usual os.path functions.

os.path accepts Path objects since Python3.6, so I feel it is actually safe to remove the cast to string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants