PermissionError: [WinError 32] with cross_val_multiscore

When I run this:

# Run the decoding analysis
import numpy as np
clf = make_pipeline(StandardScaler(), LogisticRegression(solver='lbfgs'))
time_decod = SlidingEstimator(clf, n_jobs=1, scoring='roc_auc')
scores = cross_val_multiscore(time_decod, epochs.get_data(), epochs.events[:, 2],
                              cv=5, n_jobs=1)
# Mean scores across cross-validation splits
scores = np.mean(scores, axis=0)

I get this error: PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users . . .

I’ve been able to run this code once, but subsequent attempts have given me the error. No other program should be using the file.

What can I do?

Thanks

  • MNE version: 1.7.0
  • Windows 11