mne.decoding.cross_val_multiscore produces PermissionError: [Errno 13]

Hello!
I am trying to cross validate 2 different models using GeneralizingEstimator.
The second cross validation causes the error:
PermissionError: [Errno 13] The process cannot access the file because it is being used by another process: ‘C:\Users\USERNAME\AppData\Local\Temp\tmp_mne_prog7hf6pw72’

Some more information:

  • MNE version: 1.13.0
  • operating system: Windows 10

My code:

clf = make_pipeline(StandardScaler(), LinearDiscriminantAnalysis())

time_gen1 = GeneralizingEstimator(clf, scoring=“roc_auc_ovr”, n_jobs=nf_job, verbose=True)

time_gen2 = GeneralizingEstimator(clf, scoring=“roc_auc_ovr”, n_jobs=nf_job, verbose=True)

cond1_cv= mne.decoding.cross_val_multiscore(temp_time_gen1, epochs1.get_data(), epochs1.events[:, 2], cv=6, n_jobs=-1, verbose=“error”)

cond2_cv= mne.decoding.cross_val_multiscore(temp_time_gen2, epochs2.get_data(), epochs2.events[:, 2], cv=6, n_jobs=-1, verbose=“error”)

Am I doing something wrong? is there a solution that will enable me to fit 2 models one after the other
a few more points:

  1. this happens also while fitting and scoring
  2. it doesn’t matter if 1 or 2 comes first the second one causes the error

Thank you!
Chen

I suspect a parallelization issue on windows

I would just use n_jobs=1

Alex

1 Like