How To Install python-jwt on Ubuntu 18.04

In this tutorial we learn how to install python-jwt on Ubuntu 18.04. python-jwt is Python implementation of JSON Web Token

Introduction

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

What is python-jwt

python-jwt is:

PyJWT implements the JSON Web Token draft 01, a way of representing signed content using JSON data structures.

Supported algorithms for cryptographic signing:

  • HS256 - HMAC using SHA-256 hash algorithm (default)
  • HS384 - HMAC using SHA-384 hash algorithm
  • HS512 - HMAC using SHA-512 hash algorithm
  • RS256 - RSASSA-PKCS1-v1_5 signature algorithm using SHA-256 hash algorithm
  • RS384 - RSASSA-PKCS1-v1_5 signature algorithm using SHA-384 hash algorithm
  • RS512 - RSASSA-PKCS1-v1_5 signature algorithm using SHA-512 hash algorithm

Supported reserved claim names:

  • “exp” (Expiration Time) Claim

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

sudo apt-get -y install python-jwt

Install python-jwt Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-jwt

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

sudo aptitude -y install python-jwt

How To Uninstall python-jwt on Ubuntu 18.04

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

sudo apt-get remove python-jwt

Uninstall python-jwt And Its Dependencies

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

sudo apt-get -y autoremove python-jwt

Remove python-jwt Configurations and Data

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

sudo apt-get -y purge python-jwt

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

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

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

References

Summary

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