Lincoln Shan
Lincoln Shan

Reputation: 181

How to update scikit-learn in Google Colab?

I want to use sklearn.metrics plot_confusion_matrix in Google Colab. It comes with the latest stable update of sklearn 0.22.

https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py

I tried this Make colab use the latest installation of a library

But in the end it shows the version of sklearn is still 0.21.

enter image description here

Upvotes: 4

Views: 18098

Answers (2)

Paco Iniesta
Paco Iniesta

Reputation: 71

I uninstalled sklearn from colab like you do in the start of your image and reinstalled it again updating it as it is mentioned in sklearn documentation. The code I used was the following:

!pip uninstall scikit-learn -y

!pip install -U scikit-learn

After I checked if my version was updated with:

import sklearn

sklearn.__version__

'0.24.1'

Upvotes: 7

Nouamane Tazi
Nouamane Tazi

Reputation: 19

Make sure to hit Runtime > Restart Runtime

Upvotes: 1

Related Questions