Skip to content

Track dependencies (requirements)#

You can use the dependencies argument of the init_run() function to track environment dependencies or requirements.

If you pass "infer" as the value, Neptune logs the currently installed dependencies as a requirements.txt file.

run = neptune.init_run(dependencies="infer")

You can also pass a path to your dependency file manually:

run = neptune.init_run(dependencies="path/to/file")

If you omit the dependencies argument or leave it empty, Neptune doesn't track any dependencies.

Note for Jupyter Notebooks

Neptune does not track libraries imported in notebook code cells.

To track dependencies from an .ipynb file, a separate dependency file must be present. Pass the file path to the dependencies argument, as shown above.

Viewing dependencies in the app#

To inspect the dependencies:

  1. Open the run.
  2. Navigate to the Source code tab.
  3. Select Dependencies.

Downloading the requirements file#

You can access the logged dependencies from the source_code/requirements field.

run = neptune.init_run(with_id="CLS-15", mode="read-only")
run["source_code/requirements"].download()

This results in the requirements.txt file being downloaded to the current working directory.

If you use a different file name, such as conda.env or pyproject.toml, you can pass that as the argument to the download() function:

run["source_code/requirements"].download("conda.env")

This downloads the dependency file under the specified name instead of requirements.txt.