How To Install python-inotifyx on Ubuntu 18.04

In this tutorial we learn how to install python-inotifyx on Ubuntu 18.04. python-inotifyx is simple Python binding to the Linux inotify

Introduction

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

What is python-inotifyx

python-inotifyx is:

inotifyx is a Python extension providing access to the Linux inotify file system event notification API. It is primarily written in C but has some Python window dressing

inotifyx exists as an alternative to the much known pyinotify bindings

Reasons you might choose inotifyx over pyinotify

  • inotifyx is a C extension and does not use ctypes, making it faster and less prone to subtle breakage due to changes in the inotify API
  • inotifyx is a much thinner wrapper around inotify. pyinotify is more complicated. It does provide features that inotifyx does not, but many of them are not needed by most applications
  • The API provided by pyinotify seems to change in incompatible ways on a fairly regular basis and with little justification. inotifyx has a simple API that will change rarely, if ever.

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

sudo apt-get -y install python-inotifyx

Install python-inotifyx Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-inotifyx

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

sudo aptitude -y install python-inotifyx

How To Uninstall python-inotifyx on Ubuntu 18.04

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

sudo apt-get remove python-inotifyx

Uninstall python-inotifyx And Its Dependencies

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

sudo apt-get -y autoremove python-inotifyx

Remove python-inotifyx Configurations and Data

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

sudo apt-get -y purge python-inotifyx

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

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

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

References

Summary

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