Scikit-learn: Get Error while import the module

Created on 30 Sep 2018  ·  24Comments  ·  Source: scikit-learn/scikit-learn

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

Most helpful comment

Seems like updating sklearn to 0.20.1 solves the issue!

All 24 comments

i also get this
on macOs 10.12.6
python 3.7
numpy 1.15.2
scipy 1.1.0
scikit-learn 0.20.0

It can be ignored but ideally, it should be fixed in https://github.com/cloudpipe/cloudpickle/issues/207 .

@ogrisel
did you have the same issue, and you solved?

I've read what you wrote in via the link you shared, but I could not understand the fix.
Pardon my ignorance

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

pip install cloudpickle

with cloudpickle the issue is gone!

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

pip install cloudpickle

This works!Thanks!

It seems like the issue was fixed on cloudpipe's side (see https://github.com/cloudpipe/cloudpickle/pull/208). When will it become part of sklearn?

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.

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

@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?

@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.

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

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

@ivan-marroquin Thank you! I'll be working on it later today and will come back with results.

@amueller my ide (komodo) stops completely. The error message says it's a warning but the ide treats it as an error and flags it as such. I tried running the code is vscode as well and got a similar result.

@nklein9 Either you have an option set to treat all warnings as errors (which would be kinda weird), or the issue is unrelated. If the same happens in multiple IDEs, that probably means there's a crash unrelated to the warning.

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

The downgrade to cloudpickle 0.5.6 worked. Thanks everyone.

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

pip install cloudpickle

Thanks,it also works for me.

@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.

it works in my situation

Seems like updating sklearn to 0.20.1 solves the issue!

Solved By updating
Thanks everybody

with

scikit-learn==0.20.2

no more warning is generated

pip install joblib

with

scikit-learn==0.20.2

no more warning is generated

This worked for me:
pip install scikit-learn=0.20.2

Was this page helpful?
0 / 5 - 0 ratings