question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak. "timeout or by a memory leak."

See original GitHub issue

Description

Fitting a GridSearchCV model with n_jobs = -1 gives the UserWarning mentioned below, while for n_jobs = 1 it runs without any warnings

Steps/Code to Reproduce

pipeline = Pipeline([('vect', CountVectorizer(tokenizer=tokenise)),
    ('tfidf', TfidfTransformer()),
    ('clf', MultiOutputClassifier(RandomForestClassifier(n_estimators=20, n_jobs=-1)))])

parameters = {'clf__estimator__max_depth': [10, 15],
              'clf__estimator__n_estimators': [100, 300]}
              
model = GridSearchCV(pipeline, parameters, make_scorer(fbeta_score, beta=2, average='macro'), -1, cv=2, verbose=3)

model.fit(X_train, y_train)

Expected Results

No error is thrown

Actual Results

/usr/local/lib/python3.6/dist-packages/joblib/externals/loky/process_executor.py:706: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak. "timeout or by a memory leak.", UserWarning

Versions

System: python: 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] executable: /usr/bin/python3 machine: Linux-4.14.79±x86_64-with-Ubuntu-18.04-bionic

Python deps: pip: 19.2.1 setuptools: 41.0.1 sklearn: 0.21.3 numpy: 1.16.4 scipy: 1.3.0 Cython: 0.29.13 pandas: 0.24.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
anjani-dhrangadhariyacommented, Feb 28, 2021

n_jobs=-1 causes the model to use as many available CPU resources as possible. It is better to keep this variable to -10 or even lesser in case you are sharing a server with your lab members. More information here.

3reactions
yiorgos1973commented, Sep 19, 2019

I have this error frequently when using all processors or almost all processors. Anaconda IDEs have a little matter in memory allocation and I suspect that this has also to do with that. Of course it is not an error and the results are not alterd.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A worker stopped while some jobs were given to the executor ...
The problem is too short a timeout. It is caused when there is a lot of data to pass to the child processes...
Read more >
memory leak and fails to complete on large dataset
... UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout...
Read more >
Grid Search versus Random Grid Search - Kaggle
This can be caused by a too short worker timeout or by a memory leak. ... UserWarning: A worker stopped while some jobs...
Read more >
Cancer Classification using Microarray Data - Rob McCulloch
Microarrays are an extremely important source of data, as they are very cheap and ... This can be caused by a too short...
Read more >
Hyperparameter Tuning (Supplementary Notebook)
In general, the techniques used below can be also be adapted for other forecasting ... This can be caused by a too short...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found