# Unit 4: Install FastAPI

## Creation of virtual environments

A *virtual environment* is created on top of an existing Python installation, known as the virtual environment’s "base” Python, and may optionally be isolated from the packages in the base environment, so only those explicitly installed in the virtual environment are available.

There is a wide range of  virtual environment modules in Python:

* [venv](https://docs.python.org/3/library/venv.html)
* [virtualenv](https://pypi.org/project/virtualenv/)
* [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/)
* [Anaconda](https://www.anaconda.com/download/success) *(Recommended for beginners)*

[Python](https://www.python.org/downloads/) must be installed on your computer before installing virtual environment modules. For macOS, you can take advantage of [Homebrew](https://brew.sh/) to install virtual environment modules.

Taking [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) as an example:

* To install, execute this command in CMD/Terminal: `pip install virtualenvwrapper`
* To create a new virtual environment: `mkvirtualenv env1`
* To deactivate a virtual environment: `deactivate`
* You can refer to [this document](https://virtualenvwrapper.readthedocs.io/en/latest/command_ref.html) to discover more useful commands in virtualenvwrapper.

***

## Install FastAPI

For the tutorial, you might want to install FastAPI with all the optional dependencies and features, by executing the below command in a virtual environment:

```
pip install "fastapi[all]"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fastapi-docs.duonghuuphuc.com/unit-4-install-fastapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
