Skip to content

imp module is deprecated in favour of importlib #12474

@cchorn

Description

@cchorn

Description

I have the same error as indicated on stack overflow (https://stackoverflow.com/questions/43964166/imp-module-is-deprecated-in-favour-of-importlib)
And, Khushhalm's answer on this page does fix the problem; but I'm wondering if this could be fixed permanently. Thanks.

importing sklearn modules ..

from sklearn.base import BaseEstimator, TransformerMixin

generates this error

/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

Steps/Code to Reproduce

starting the Python terminal and entering the following

from sklearn.base import BaseEstimator, TransformerMixin

generates this error

/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

Expected Results

No error is thrown.

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

Versions

System

python: 3.6.6 (default, Sep 12 2018, 18:26:19)  [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]

executable: /usr/local/bin/python
machine: Linux-4.4.0-137-generic-x86_64-with-Ubuntu-18.04-bionic

BLAS

macros:

lib_dirs:
cblas_libs: cblas

Python deps

   pip: 18.1

setuptools: 39.0.1
sklearn: 0.20.0
numpy: 1.15.2
scipy: 1.1.0
Cython: 0.29
pandas: 0.23.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions