How To Install python-faulthandler on Ubuntu 18.04

In this tutorial we learn how to install python-faulthandler on Ubuntu 18.04. python-faulthandler is Display the Python backtrace on a crash

Introduction

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

What is python-faulthandler

python-faulthandler is:

Fault handler for SIGSEGV, SIGFPE, SIGBUS and SIGILL signals: it displays the Python backtrace and restores the previous handler. It allocates an alternate stack for this handler, if signaltstack() is available, to be able to allocate memory on the stack, even on stack overflow.

There are three methods to install python-faulthandler 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-faulthandler 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-faulthandler using apt-get by running the following command:

sudo apt-get -y install python-faulthandler

Install python-faulthandler Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-faulthandler

Install python-faulthandler 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-faulthandler using aptitude by running the following command:

sudo aptitude -y install python-faulthandler

How To Uninstall python-faulthandler on Ubuntu 18.04

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

sudo apt-get remove python-faulthandler

Uninstall python-faulthandler And Its Dependencies

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

sudo apt-get -y autoremove python-faulthandler

Remove python-faulthandler Configurations and Data

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

sudo apt-get -y purge python-faulthandler

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

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

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

References

Summary

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