How To Install python-fakeredis on Ubuntu 18.04

In this tutorial we learn how to install python-fakeredis on Ubuntu 18.04. python-fakeredis is Fake version of a redis-py - Python 2.x

Introduction

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

What is python-fakeredis

python-fakeredis is:

fakeredis is a pure Python implementation of the redis-py Python client that simulates talking to a redis server. This was created for a single purpose: to write unittests. Setting up redis is not hard, but many times you want to write unittests that do not talk to an external server (such as redis). This module now allows tests to simply use this module as a reasonable substitute for redis.

This package contains the Python 2.x module.

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

sudo apt-get -y install python-fakeredis

Install python-fakeredis Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-fakeredis

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

sudo aptitude -y install python-fakeredis

How To Uninstall python-fakeredis on Ubuntu 18.04

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

sudo apt-get remove python-fakeredis

Uninstall python-fakeredis And Its Dependencies

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

sudo apt-get -y autoremove python-fakeredis

Remove python-fakeredis Configurations and Data

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

sudo apt-get -y purge python-fakeredis

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

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

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

References

Summary

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