ModuleNotFoundError: No module named 'sklearn.inspection'

Khalid538
Khalid538 Partner, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 9 Partner

One of our SME is trying to build a ML model using the package scikit-learn and this package is already present in our default Python environment but she is getting following error in the Jupyter Notebook. i have attached the error code.


Operating system used: Cent OS

Tagged:

Answers

  • Catalina
    Catalina Dataiker, Dataiku DSS Core Designer, Registered Posts: 135 Dataiker

    Hi @Khalid538
    ,

    The error indicates that the package scikit-learn is missing from your default Python environment. As stated in the documentation installing Python packages in the built-in DSS environment is not recommended. In addition trying to install the package using pip directly in the notebook is not advised. The solution is to use code environments to create a code environment and then add scikit-learn to the list of required packages. After that, you can change the code environment in the notebook by going to Kernel>Change Kernel and select the code environment that contains the needed package.

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker

    Just to Catalina's response. The reason you should create a custom code env is sklearn.inspection was introduced in version 0.21.0. The default DSS version is 0.20.4. Hence the error you are receiving the "No module named" error.

    To use sklearn.inspection you need to create a custom code env with the requirement:

    scikit-learn>=1.0,<1.1

    Note there is experimental support DSS 11 there experimental support for scikit-learn 1. This version should work with visual ML. As well if you don't need Visual ML then you are free to use another version > 0.2.1

    Hope this helps.

Setup Info
    Tags
      Help me…