Closed roya2022 closed 1 year ago
This seems to be a nilearn issue. My guess is you want to start with a clean virtual environment and install the needed packages in one go.
Thank you so much for the answer I have 2 question; 1-Should I uninstall and install nilrearn? 2- now I have one preprocessing under fmriprep on run (its possible to uninstall and install nilrearn coincidently with fmriprep )
I would create a new environment, e.g. with conda
or virtualenv
. If you're using conda, use conda create -n myenv python=3.9
(or whatever version you like). If you're not using conda, then virtualenv myenv
.
conda create -n myenv python=3.9
conda activate myenv
pip install nilearn
or
virtualenv myenv
source myenv/bin/activate
pip install nilearn
This will not interfere with your environment containing fmriprep in any way. On the other hand, that environment might have been broken by the previous installation/upgrade attempts.
Thank you, I did the first one you suggested.
but when I ran
from nilearn.maskers import NiftiMapsMasker masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True, memory='nilearn_cache', verbose=5) masker.fit(data.func[0]) time_series = masker.transform(data.func[0], confounds=data.confounds)
I faced this error again;
ImportError: cannot import name 'stringify_path' from 'nilearn._utils' (/home/roya/.local/lib/python3.8/site-packages/nilearn/_utils/init.py)
/home/roya/.local/lib/python3.8/site-packages/nilearn/_utils/__init__.py
indicates that your Python process is not in the virtual environment.
I appreciate your help if it is possible could you please how should I go for this kind of environment I mean how should I fix the error
I'm sorry, this fell off my plate. The issues list here is only intermittently monitored, and I expect that most people who saw this saw that I was responding and so didn't step in.
Since this is not a Nipype issue, but a Python environment one, I think you'll get more prompt feedback on a more general forum, such as Neurostars: https://neurostars.org
Summary
I'm trying to extracting signals of a probabilistic atlas of functional regions
Actual behavior & ### Expected behavior
since I'm running the code line by line, I was expecting that I would be able to build and display a correlation matrix
Script/Workflow details
Please put URL to code or code here (if not too long).
(https://nilearn.github.io/dev/auto_examples/03_connectivity/plot_probabilistic_atlas_extraction.html)
Platform details:
I wanted to upgrade nilearn using by (pip install --upgrade nilearn ), that was the error I faced while upgrading;
ERROR: scipy 1.7.3 has requirement numpy<1.23.0,>=1.16.5, but you'll have numpy 1.23.2 which is incompatible. ERROR: nipype 1.7.0 has requirement prov>=1.5.2, but you'll have prov 1.5.0 which is incompatible. the last lines of upgrading were ;
Installing collected packages: numpy, nilearn Attempting uninstall: nilearn Found existing installation: nilearn 0.8.1 Uninstalling nilearn-0.8.1: Successfully uninstalled nilearn-0.8.1 Successfully installed nilearn-0.9.2 numpy-1.23.2 Note: you may need to restart the kernel to use updated packages.
and then I used this code ; pip install -U scikit-learn according some advise from communities.
when I wanted to run from nilearn.maskers import NiftiMapsMasker masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True, memory='nilearn_cache', verbose=5) masker.fit(data.func[0]) time_series = masker.transform(data.func[0], confounds=data.confounds)
To extract the time series which is used for building correlation matrix;
I encountered this error;
ImportError Traceback (most recent call last) /tmp/ipykernel_132175/4271522568.py in
----> 1 from nilearn.maskers import NiftiMapsMasker
2 masker = NiftiMapsMasker(maps_img=atlas_filename, standardize=True,
3 memory='nilearn_cache', verbose=5)
4 masker.fit(data.func[0])
5 time_series = masker.transform(data.func[0],
~/.local/lib/python3.8/site-packages/nilearn/maskers/init.py in
3 """
4
----> 5 from .base_masker import BaseMasker
6 from .nifti_masker import NiftiMasker
7 from .multi_nifti_masker import MultiNiftiMasker
~/.local/lib/python3.8/site-packages/nilearn/maskers/base_masker.py in
19 from .._utils.cache_mixin import CacheMixin, cache
20 from .._utils.class_inspect import enclosing_scope_name
---> 21 from .._utils import stringify_path
22 from nilearn.image import high_variance_confounds
23
ImportError: cannot import name 'stringify_path' from 'nilearn._utils' (/home/roya/.local/lib/python3.8/site-packages/nilearn/_utils/init.py)
Execution environment
jupyer- linux
actually I've have already done fmriprep for one subject and obtain ts for that through this codes;
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwi75fzH-_H5AhWmMVkFHf2GCyAQFnoECAkQAQ&url=https%3A%2F%2Fnideconv.readthedocs.io%2Fen%2Flatest%2F_downloads%2F2ca39f450881072366a34e648b33a849%2Fextract_timeseries_fmriprep.py&usg=AOvVaw0ufc80XcATGm4GVN4HUX9e
but my next goal is extracting the connectivity R values between the cortical regions.
Any suggestion would be appreciate. Best, Roqa