> ## Documentation Index
> Fetch the complete documentation index at: https://docs.domino.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Use requirements.txt (Python only)

Unless package persistence is enabled, Domino runs each script or interactive session in a fresh environment. In this case, any custom packages are reinstalled at the start of each execution.

To add Python dependencies to your project:

* Create a [requirements.txt](https://pip.pypa.io/en/latest/user_guide/#requirements-files) file in the root of your project directory.

* List the required packages using standard pip syntax.

Domino will install these packages automatically at runtime.

Domino provides flexibility, so if you want your changes to remain permanently installed, see [Preload Environment packages](/cloud/platform-capabilities/core-concepts/compute-environments/add-packages-to-environments/preload-environment-packages) to create a custom environment.

Many common modules are installed by default. To get a list of pre-installed modules, include `help('modules')` at the start of your script or in a new IPython Notebook session. You can also run `domino run --direct "pip freeze"` with the Domino CLI tool.

## Improve execution startup time

Using a `requirements.txt` file allows you to specify and install Python dependencies at runtime. However, this approach comes with trade-offs:

* For each execution, Domino installs the listed packages from scratch, which can increase startup time.

To optimize performance based on your use case:

* **For Workspaces:** Enable package persistence to install packages once during initial startup. These packages will then be retained between sessions, avoiding repeat installations and significantly reducing startup time for future launches.

* **For Jobs, Apps, and other executions:** Use preloaded Environment packages to build a custom environment where packages are baked into the image. This ensures packages are available immediately and persist across all executions, avoiding any runtime installation cost.

By selecting the correct installation strategy, you can strike a balance between flexibility and faster execution times.

## Add your own packages

To define additional dependencies, create a `requirements.txt` file and place it in the root of your project directory.

<Note>
  If your project is [Git-based](/cloud/platform-capabilities/core-concepts/projects/manage-git-projects), the `requirements.txt` file must be located in the `Code/` folder within your project’s directory.
</Note>

The `requirements.txt` file should list all required Python packages using standard pip syntax. You can specify exact versions, minimum versions, or allow the latest versions, along with which libraries to use. For example:

```bash theme={null}
pandas
lxml==3.2.3
numpy>=1.7.1
```

Domino will automatically install the listed packages at the start of each execution, unless package persistence or preloaded environments are used to optimize startup time.

### Install packages interactively in Workspaces

If you’re working in a Jupyter Notebook, you can also install packages interactively using pip directly in a notebook cell:

```bash theme={null}
! pip install --user <package>
```

The '!' prefix runs the command in the shell from within the notebook environment.

## Generate a requirements.txt file

If you’re using pip on your local machine, the easiest way to generate the requirements.txt file is to run the following command in the root of your project folder (or in the Code folder if your project is Git-based):

```bash theme={null}
~/domino/myProject $ pip freeze > requirements.txt
```

For performance reasons, prune the file to include only the libraries needed for your analysis.

## Install packages hosted from a Git repository

<Warning>
  This is an advanced topic.
</Warning>

Pip can install Python packages from source by cloning a public Git repository over HTTPs. See [pip install](https://pip.pypa.io/en/stable/cli/pip_install/#git) for reference. To specify this, you must add something like the following line to your `requirements.txt` file:

```shell theme={null}
-e git+https://git.yourproject.org/you/Project.git#egg=YourProject
```

The most common host of Git projects is GitHub. If the package you want to install is publicly accessible, then the previous instructions will work. However, if you must install private repositories, Domino can securely integrate with GitHub to access them. See [Import Git Repositories](/cloud/platform-capabilities/core-concepts/projects/manage-dfs-projects/import-git-repositories) for information about securely storing your Github credentials.

<Warning>
  Do not embed your GitHub credentials directly in the `requirements.txt` file. Instead, integrate Domino with GitHub securely by following the instructions in [Import Git Repositories](/cloud/platform-capabilities/core-concepts/projects/manage-dfs-projects/import-git-repositories).
</Warning>
