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.

ImportError: cannot import name 'enable_halving_search_cv' from 'sklearn.experimental' (C:\Users\Administrator\anaconda3\lib\site-packages\sklearn\experimental\__init__.py)

See original GitHub issue

Describe the bug

Cannot import enable_halving_search_cv from sklearn as documented in sklearn manual.

Steps/Code to Reproduce

Example:

from sklearn.experimental import enable_halving_search_cv
from sklearn.model_selection import HalvingRandomSearchCV

Actual Results

ImportError: cannot import name 'enable_halving_search_cv' from 'sklearn.experimental' (C:\Users\Administrator\anaconda3\lib\site-packages\sklearn\experimental\__init__.py)

Versions

System: python: 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] executable: C:\Users\Administrator\anaconda3\python.exe machine: Windows-10-10.0.18362-SP0

Python dependencies: pip: 20.2.4 setuptools: 50.3.1.post20201107 sklearn: 0.23.2 numpy: 1.19.2 scipy: 1.5.2 Cython: 0.29.21 pandas: 1.1.3 matplotlib: 3.3.2 joblib: 0.17.0 threadpoolctl: 2.1.0

Built with OpenMP: True

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
TDHTTTTcommented, Dec 6, 2021

@mridunanda Make sure you have this line before importing. That was the issue for me. from sklearn.experimental import enable_halving_search_cv

2reactions
glemaitrecommented, Jan 8, 2021

You need to update scikit-learn 0.24 using pip or conda-forge.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: cannot import name 'HalvingGridSearchCV' from ...
This must be run first: from sklearn.experimental import enable_halving_search_cv. and then this: from sklearn.model_selection import ...
Read more >
sklearn.model_selection.HalvingRandomSearchCV
In this case, min_resources cannot be 'exhaust'. factorint or float, default=3. The 'halving' parameter, which determines the proportion of candidates that are ...
Read more >
Fix ModuleNotFoundError: No module named 'sklearn'
This error indicates that the scikit-learn (aka sklearn ) package was not installed, or even if it was installed for some reason it...
Read more >
How to Fix : “ImportError: Cannot import name X” in Python?
You can solve the “ ImportError : Cannot import name X” Error by resolving the circular dependencies. You can do that either by...
Read more >
ImportError cannot import name LinearRegression from sklearn
I installed this model but I am getting this below error. from sklearn import LinearRegression ImportError: cannot import name 'LinearRegression ...
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