PyGraphViz Python libraries are used to plot causal inference networks.
If you try to install PyGraphViz as a standard library, it fails due to dependency errors.
PyGraphViz has the following dependencies:
- python3-dev
- graphviz
- libgraphviz-dev
- pkg-config
Install via notebook
- Install the dependencies with apt-get.
%sh sudo apt-get install -y python3-dev graphviz libgraphviz-dev pkg-config
- After the dependencies are installed, use pip to install PyGraphViz.
%sh pip install pygraphviz
Install via init script
- Create the init script.
%python dbutils.fs.put("dbfs:/databricks/<init-script-folder>/install-pygraphviz.sh", """ #!/bin/bash #install dependent packages sudo apt-get install -y python3-dev graphviz libgraphviz-dev pkg-config pip install pygraphviz""", True)
- Install the init script that you just created as a cluster-scoped init script (AWS | Azure | GCP).
You will need the full path to the location of the script (dbfs:/databricks/<init-script-folder>/install-pygraphviz.sh). - Restart the cluster after you have installed the init script.