0

I am trying to export my dependencies to a requirements.txt or environment.yml file for pip or conda respectively - in order to host a Binder notebook.

How can I get only the dependencies that my notebook is using?

When I tried pip freeze or conda env export, I get all my installed packages, which leads to errors when building the Docker environment.

max
  • 4,141
  • 5
  • 26
  • 55

1 Answers1

0

You might want to try watermark:

Install:

pip install watermark

Then, in your notebook:

# Load the extension
%load_ext watermark

# import your libraries
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Determine the dependency version
%watermark -p numpy,matplotlib,seaborn

The results will look like this:

numpy 1.14.3
matplotlib 2.2.2
seaborn 0.9.0
LucasBoatwright
  • 1,456
  • 1
  • 16
  • 20