Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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'`
like image 741
Nume Avatar asked Jan 20 '21 19:01

Nume


Video Answer


3 Answers

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

like image 162
Nume Avatar answered Oct 16 '22 17:10

Nume


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.

like image 30
T-rex Avatar answered Oct 16 '22 17:10

T-rex


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.

like image 4
Alexey Yurasov Avatar answered Oct 16 '22 17:10

Alexey Yurasov