Skip to content

imp module is deprecated in favour of importlib #12474

Closed

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

Activity

  1. amueller commented on Oct 28, 2018

    @amueller
    Member

    duplicate of ##12434
    I guess we can keep this one open as people don't seem to search closed issues.

    Btw, this is not an error, it's a warning, so you do get your expected results of no errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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