By default, Domino runs each of your scripts (or interactive sessions) from a fresh environment. This means that packages are installed to your environment every time you start an execution. If you want your changes to remain permanently installed with increased execution times, see Use Dockerfile Instructions to create custom environments.
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.
Add your own packages
To specify additional dependencies, use pip with Domino.
To specify module dependencies for your project, add a pip requirements file named requirements.txt
to the root of your project folder.
The requirements file specifies which libraries and any version requirements for them. For example:
pandas
lxml==3.2.3
numpy>=1.7.1
See pip install requirements file format for the syntax of the requirements 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 Artifacts folder if your project is Git-based):
~/domino/myProject $ pip freeze > requirements.txt
For performance reasons, prune the file so that it includes only the libraries needed for your analysis.
If you’re working in a Jupyter Notebook, you can also use pip
to install dependencies interactively.
In a notebook cell, you can run:
! pip install --user <package>
(The '!' tells the notebook to execute the cell as a shell command.)
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 your requirements.txt
file:
-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 those private repositories. See Import Git Repositories for information about securely storing your Github credentials.