How To Install python3-fastapi on Debian 12

Learn how to install python3-fastapi on Debian 12 with this tutorial. python3-fastapi is modern, fast, web framework for building APIs, based on type hints

Introduction

In this tutorial we learn how to install python3-fastapi on Debian 12.

What is python3-fastapi

python3-fastapi is:

FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.

The key features are:

  • Fast: Very high performance, on par with NodeJS and Go (thanks to Starlette

  • and Pydantic). One of the fastest Python frameworks available.

  • Fast to code: Increase the speed to develop features by about 200% to 300%.

  • (note1)

  • Fewer bugs: Reduce about 40% of human (developer) induced errors. (note1)

  • Intuitive: Great editor support. Completion everywhere. Less time debugging.

  • Easy: Designed to be easy to use and learn. Less time reading docs.

  • Short: Minimize code duplication. Multiple features from each parameter

  • declaration. Fewer bugs.

  • Robust: Get production-ready code. With automatic interactive documentation.

  • Standards-based: Based on (and fully compatible with) the open standards for

  • APIs: OpenAPI (previously known as Swagger) and JSON Schema.

(note1) estimation based on tests on an internal development team, building production applications.

There are three methods to install python3-fastapi on Debian 12. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python3-fastapi Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install python3-fastapi

Install python3-fastapi Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python3-fastapi

Install python3-fastapi 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 Debian. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install python3-fastapi

How To Uninstall python3-fastapi on Debian 12

To uninstall only the python3-fastapi package we can use the following command:

sudo apt-get remove python3-fastapi

Uninstall python3-fastapi And Its Dependencies

To uninstall python3-fastapi and its dependencies that are no longer needed by Debian 12, we can use the command below:

sudo apt-get -y autoremove python3-fastapi

Remove python3-fastapi Configurations and Data

To remove python3-fastapi configuration and data from Debian 12 we can use the following command:

sudo apt-get -y purge python3-fastapi

Remove python3-fastapi configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python3-fastapi

Dependencies

python3-fastapi have the following dependencies:

References

Summary

In this tutorial we learn how to install python3-fastapi package on Debian 12 using different package management tools: apt, apt-get and aptitude.