2

I'm trying to run a parallelised GridSearchCV in a Jupiter Notebook on a MacBook. I get the error:

ImportError: [joblib] Attempting to do parallel computing without protecting your import on a system that does not support forking. To use parallel-computing in a script, you must protect your main loop using "if name == 'main'". Please see the joblib documentation on Parallel for more information

I've seen the following threads, but they won't work for me: the code below still produces the same error. What am I missing?

def somefunction():
    gs_clf = GridSearchCV(text_clf, parameters, n_jobs=-1)
    gs_clf = gs_clf.fit(df_resolved.rawtext, df_resolved['assignment_group.name'])

if __name__ == '__main__':
    somefunction()
lte__
  • 7,175
  • 25
  • 74
  • 131
  • How are text_clf, parameters defined and where? How have you imported the GridSearchCV? There is some code which is executing outside the main block (maybe reading the data or something). It all needs to be inside. – Vivek Kumar Sep 07 '17 at 13:00

0 Answers0