10000 [BUG] _joblib_parallel_args removed in latest scikit-learn dev build · Issue #894 · scikit-learn-contrib/imbalanced-learn · GitHub
[go: up one dir, main page]

Skip to content

[BUG] _joblib_parallel_args removed in latest scikit-learn dev build #894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
torshind opened this issue Feb 24, 2022 · 12 comments
Closed

[BUG] _joblib_parallel_args removed in latest scikit-learn dev build #894

torshind opened this issue Feb 24, 2022 · 12 comments

Comments

@torshind
Copy link

Describe the bug

Unable to import SMOTE using scikit-learn nightly

Steps/Code to Reproduce

from imblearn.over_sampling import SMOTE

Expected Results

No error is thrown.

Actual Results

  File "/opt/conda/lib/python3.9/site-packages/imblearn/__init__.py", line 53, in <module>
    from . import ensemble
  File "/opt/conda/lib/python3.9/site-packages/imblearn/ensemble/__init__.py", line 8, in <module>
    from ._forest import BalancedRandomForestClassifier
  File "/opt/conda/lib/python3.9/site-packages/imblearn/ensemble/_forest.py", line 28, in <module>
    from sklearn.utils.fixes import _joblib_parallel_args
ImportError: cannot import name '_joblib_parallel_args' from 'sklearn.utils.fixes' (/opt/conda/lib/python3.9/site-packages/sklearn/utils/fixes.py)

Versions

/opt/conda/lib/python3.9/site-packages/_distutils_hack/__init__.py:36: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")

System:
    python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:20:46)  [GCC 9.4.0]
executable: /opt/conda/bin/python
   machine: Linux-5.4.0-91-generic-x86_64-with-glibc2.31

Python dependencies:
          pip: 21.3.1
   setuptools: 60.2.0
      sklearn: 1.1.dev0
        numpy: 1.22.2
        scipy: 1.7.3
       Cython: None
       pandas: 1.4.1
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.0.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: libgomp
       filepath: /opt/conda/lib/python3.9/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
        version: None
    num_threads: 64

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /opt/conda/lib/python3.9/site-packages/numpy.libs/libopenblas64_p-r0-2f7c42d4.3.18.so
        version: 0.3.18
threading_layer: pthreads
   architecture: SkylakeX
    num_threads: 64

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /opt/conda/lib/python3.9/site-packages/scipy.libs/libopenblasp-r0-8b9e111f.3.17.so
        version: 0.3.17
threading_layer: pthreads
   architecture: SkylakeX
    num_threads: 64

imbalanced-learn==0.9.0

@chkoar
Copy link
Member
chkoar commented Feb 24, 2022

Thanks for reporting. This PR bumbed the version of joblib and removed the_joblib_parallel_args.

@glemaitre
Copy link
Member

We should merge the fix just after scikit-learn is released.

@4d30
Copy link
4d30 commented May 12, 2022

What can we do in the meantime?

@glemaitre
Copy link
Member

Just do not update yet. I will make a release in the weekend as scikit-learn has been released today.

@MaximeKan
Copy link

Any update? This seems to be broken now :/

@glemaitre
Copy link
Member

This will not solve the issue. You just need to wait for the release.

@glemaitre
Copy link
Member

This has been fixed in master and the release is already on PyPI and soon in conda-forge.

@ngupta23
Copy link

Is there a way to still have imblearn be compatible with sklearn 1.0.2?

@glemaitre
Copy link
Member

You can install pin to the 0.9.0 version. There is no difference in the features available.

@Genarito
Copy link

Hi, is there any update on this issue? I need to use the n_iter_ attribute in SVM (present in 1.1.1 version) but if upgrade, this breaks the project.

@glemaitre
Copy link
Member
glemaitre commented Jun 27, 2022

The last version of imbalanced-learn (0.9.1) is compatible with the last version of scikit-learn (1.1.1).

@now-youre-gittin-it
Copy link

[Solution] I've been facing ImportError: cannot import name '_joblib_parallel_args' from 'sklearn.utils.fixes' while trying to import ADASYN from imblearn to perform oversampling. The strange thing is there was no error the first one or two times I ran my code, but it started showing up subsequently.

This was my code for reference:

from imblearn.over_sampling import ADASYN
print('Before')
print(y_train.value_counts())

# Oversampling the training dataset
ada= ADASYN (random_state=130)
X_train_ada, y_train_ada= ada.fit_resample(X_train, y_train)

print('After')
print(y_train_ada.value_counts())

Package Versions: sckit-learn v0.9.0 and scikit-learn v1.1.2
I can't downgrade scikit-learn to 1.1.1 because it might have ramifications for other projects.

Strange solution that worked:
I moved the import statement i.e. from imblearn.over_sampling import ADASYN to a separate cell (VSCode notebook).
The rest of the code went in a separate cell, and now when I exceute the 2 cells, voila, no error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
0