- Create a requirements.txt file in the root of your project directory.
- List the required packages using standard pip syntax.
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 arequirements.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.
- 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.
Add your own packages
To define additional dependencies, create arequirements.txt file and place it in the root of your project directory.
If your project is Git-based, the
requirements.txt file must be located in the Code/ folder within your project’s directory.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:
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: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):Install packages hosted from a Git repository
Pip can install Python packages from source by cloning a public Git repository over HTTPs. See pip install for reference. To specify this, you must add something like the following line to yourrequirements.txt file: