How To Install python-sklearn on Ubuntu 18.04

In this tutorial we learn how to install python-sklearn on Ubuntu 18.04. python-sklearn is Python modules for machine learning and data mining

Introduction

In this tutorial we learn how to install python-sklearn on Ubuntu 18.04.

What is python-sklearn

python-sklearn is:

scikit-learn is a collection of Python modules relevant to machine/statistical learning and data mining. Non-exhaustive list of included functionality:

  • Gaussian Mixture Models
  • Manifold learning
  • kNN
  • SVM (via LIBSVM)

There are three methods to install python-sklearn on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-sklearn Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-sklearn using apt-get by running the following command:

sudo apt-get -y install python-sklearn

Install python-sklearn Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-sklearn using apt by running the following command:

sudo apt -y install python-sklearn

Install python-sklearn Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-sklearn using aptitude by running the following command:

sudo aptitude -y install python-sklearn

How To Uninstall python-sklearn on Ubuntu 18.04

To uninstall only the python-sklearn package we can use the following command:

sudo apt-get remove python-sklearn

Uninstall python-sklearn And Its Dependencies

To uninstall python-sklearn and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-sklearn

Remove python-sklearn Configurations and Data

To remove python-sklearn configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-sklearn

Remove python-sklearn configuration, data, and all of its dependencies

We can use the following command to remove python-sklearn configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-sklearn

References

Summary

In this tutorial we learn how to install python-sklearn package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.