Skip to content
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

ImportError: cannot import name '_fit_context' from 'sklearn.base' #816

Open
sali316 opened this issue Sep 24, 2024 · 1 comment
Open

ImportError: cannot import name '_fit_context' from 'sklearn.base' #816

sali316 opened this issue Sep 24, 2024 · 1 comment
Labels
question Further information is requested

Comments

@sali316
Copy link

sali316 commented Sep 24, 2024

Describe the bug
I installed latest version of feature-engine. When I try to import RareLabelEncoder and OrdinalEncoder classes, I get ImportError: cannot import name '_fit_context' from 'sklearn.base'

To Reproduce
Steps to reproduce the behavior:

  1. from feature_engine.encoding import (
    RareLabelEncoder,
    OrdinalEncoder,
    )

Expected behavior
I should be able to import without seeing the error. I also tried using scikit-learn=1.4.0 with feature-engine=1.6.0 but got same error.

Versions used
feature-engine: 1.8.1
scikit-learn: 1.5.2
python: 3.9.12
jupyter notebook: 6.5.2

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Chrome
@solegalli
Copy link
Collaborator

Hey @sali316

Sorry to hear about this issue. I can't, unfortunately, reproduce it in my system.

The following command:

from feature_engine.encoding import (
    RareLabelEncoder,
    OrdinalEncoder,
)

runs without a problem.

These are my versions:

sklearn = '1.5.2'
pandas = '2.2.3'
numpy = '1.26.4'
feature_engine = '1.8.1'

Could you try updating or downgrading your versions and see if that solves the issue? I am aware that sklearn has still not caught up with the latest release of numpy, maybe that is the issue? it supports numpy 1.26.4 at most.

Please let me know if you solve it or if it persists, in which case, I need the versions of additional libraries.

Thank you!

@solegalli solegalli added the question Further information is requested label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants