scikit-learn: Get Error while import the module

Description

I get this error after importing the module /usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp

Can I ignore it? How to solve it?

Steps/Code to Reproduce

import sklearn

Expected Results

NO ISSUE

Actual Results

/usr/local/lib/python3.6/dist-packages/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp

Versions

PLATFORM=Linux-4.15.0-34-generic-x86_64-with-Ubuntu-18.04-bionic PYTHON=Python 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0] NUMPY=NumPy 1.15.2 SCIPY= SciPy 1.1.0 SKLEARN=Scikit-Learn 0.20rc1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 18
  • Comments: 24 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I face the same issue. Just try to install cloudpickle library. It works for me.

pip install cloudpickle

Seems like updating sklearn to 0.20.1 solves the issue!

The downgrade to cloudpickle 0.5.6 worked. Thanks everyone.

btw this is a warning so really there is no issue to fix…

Hi all,

I had the same installation version as the one listed by @nklein9 in the previous post on an Ubuntu 18.04 machine. So, I removed cloudpickle 0.6.0 and installed version 0.5.6 - following suggestion from @yyb1995. Changing the version fixed the problem!

Thanks, Ivan

@amueller you are right, especially because the warning is printed to stderr, not stdout. Using cloudpickle 0.5.6 eliminated the warning.

@nklein9 same here

>pip freeze
cloudpickle==0.6.0
numpy==1.15.2
Pillow==5.3.0
scikit-learn==0.20.0
scipy==1.1.0
>py -3 --version
Python 3.6.5 :: Anaconda, Inc.

Windows 10 x64

Any ideas?

The only difference is my cloudpickle version is 0.5.6. Maybe you can try this version. Not sure whether it will help.

I’ve just installed cloudpickle and am still getting the error. This is after a restart as well. I’m quite new at this and don’t know how to troubleshoot it efficiently.

Windows 10pro 64bit Python version 3.7.0 numpy version 1.15.1 scipy version 1.1.0 sklearn version 0.20.0 cloudpickle version 0.6.0

I released cloudpickle 0.6.0. It will be part of scikit-learn 0.20.1 in a couple of days or 0.20.2 at most.

pip install joblib

with

scikit-learn==0.20.2

no more warning is generated