How to add dependencies to your capsule
Code Ocean's Run Environment screen presents a user-friendly and transparent interface for installing dependencies. It supports a variety of language-specific package managers, as well as APT, the Linux operating system-level package manager.
When would dependencies be installed?
The dependencies you add will be installed the next time you run your code. This installation process is triggered when you install new packages, and the results are subsequently cached for future runs.
While your code is executing, the bottom Output pane will automatically open, allowing you to monitor progress and inspect the results of commands executed during the setup phase. Once the run completes (or is stopped), this output will be available in a file called
SetupLog in your results. See Monitoring and inspecting the result of the environment setup phase for more information.
Most package managers are available out of the box
This varies from language to language, i.e.,
pip for Python,
CRAN for R, etc. – with
apt-get available at the outset for all capsules.
The platform also dynamically detects package managers installed as dependencies. For example, if you'd like to use both MATLAB and Python, add
apt-get dependencies; the pip installer will then become available for you to use.
By default, when you install a new dependency, The "Version" column will display "latest." Once a package is installed, clicking the gear icon will subsequently reveal exactly which version of the package was installed, e.g. 5.4.1. Specifying the package versions is important for reproducibility.
To install a package version other than "latest," you can manually edit the number in the Version column:
If one of the dependencies you require happens to be pre-installed as part of the base environment, the system will let you know this is the case when you add it. If you require a different version of the package, edit the version field; enter "latest" to instruct the system to install the latest available version.
Further customization options
Code Ocean also provides a more flexible Setup Script for dependencies not available through our native package managers. See Using the Setup Script for further customization.