Error - Nilearn DictLearning

Hi all,

I am using Nilearn.decompositions DictLearning (6.4. Region Extraction for better brain parcellations - Nilearn) to run an ICA but failed while running, errors see below.

Traceback (most recent call last):

  File "/var/folders/xx/9wp086tx1nnbfntx9631wc1h0000gn/T/ipykernel_3807/", line 21, in <module>

  File "/Users/jd/opt/anaconda3/lib/python3.9/site-packages/nilearn/decomposition/", line 448, in fit

  File "/Users/jd/opt/anaconda3/lib/python3.9/site-packages/nilearn/decomposition/", line 306, in _raw_fit
    self.components_, _ = self._cache(dict_learning_online)(

  File "/Users/jd/opt/anaconda3/lib/python3.9/site-packages/joblib/", line 573, in __call__
    return self._cached_call(args, kwargs, shelving=False)

  File "/Users/jd/opt/anaconda3/lib/python3.9/site-packages/joblib/", line 482, in _cached_call
    args_id = self._get_args_id(*args, **kwargs)

  File "/Users/jd/opt/anaconda3/lib/python3.9/site-packages/joblib/", line 612, in _get_args_id
    return hashing.hash(filter_args(self.func, self.ignore, args, kwargs),

  File "/Users/jd/opt/anaconda3/lib/python3.9/site-packages/joblib/", line 306, in filter_args
    raise TypeError("Ignore list for %s() contains an unexpected "

TypeError: Ignore list for dict_learning_online() contains an unexpected keyword argument 'max_iter'

I would appreciate it if you know the potential solution!

Thank you

are you reusing an old cache ? Or is it the first time you run this function ?
You can e.g. clear the cache.
Please LMK

Hi Bertrand,
Thank you so much for your help. I just clear everything in the nilearn_cache folder, and ran it, I still have that issue. Let me know if you have further thoughts, I really appreciate it.

Hi Bertrand,

I just upgrade the scikit-learn versio on my python and it works, see this: Got an unexpected keyword argument 'max_iter' in SGDClassifier · Issue #328 · ClimbsRocks/auto_ml · GitHub

Great to see that. Bertrand