cannot import name 'delayed' from 'sklearn.utils.fixes'

Viewed 26887

How should the cannot import name 'delayed' from 'sklearn.utils.fixes be solved? I have already updated sklearn and upgraded conda as well.

~\.conda\envs\base2\lib\site-packages\sklearn\metrics\pairwise.py in <module>
         30 from ..utils._mask import _get_mask
         31 from ..utils.validation import _deprecate_positional_args
    ---> 32 from ..utils.fixes import delayed
         33 from ..utils.fixes import sp_version, parse_version
         34 
    
    ImportError: cannot import name 'delayed' from 'sklearn.utils.fixes'`
3 Answers

After the installation via pip install delayed and then restarting the kernel, the problem was solved.

Use the following commands:

conda install -c conda-forge imbalanced-learn
conda install nb_conda # to grant to select conda environments as core of jupyter notebook

See more at this link.

Restarting the kernel solved the issue for me.

If you check your log, somehow you upgraded some modules, and kernels need to be restarted sometimes, to get the changes reflected in the system.

Related