By default, Domino runs each of your scripts (or interactive sessions) from a fresh environment.
This means that packages are installed in your environment every time you start an execution. To specify additional dependencies, you can add a pip requirements file named requirements.txt
to the root of your project folder.
Domino provides flexibility, so if you want your changes to remain permanently installed, see 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.
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.
Warning
|
Using requirements.txt causes packages to install on every execution startup, slowing down the process. If you want your packages to remain permanently installed and reduce startup time, consider preloading Environment packages.
|
The requirements file specifies which libraries and any version requirements for them. Follow the proper syntax for the pip install requirements file. For example:
pandas
lxml==3.2.3
numpy>=1.7.1
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.)
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:
~/domino/myProject $ pip freeze > requirements.txt
For performance reasons, prune the file so that it includes only the libraries needed for your analysis.
Caution
| This is an advanced topic. |
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.
Caution
|
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.
|