TIL: Install options for pip in requirements.txt

So I was trying to install pygraphviz and I ran into the annoying issue where it couldn't find the path to the system install binaries.

Package libcgraph was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcgraph.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcgraph' found

Unfortunately as is the case with packages that aren't pure python you have to install extra libraries on the system path.

sudo apt-get install python-dev graphviz libgraphviz-dev pkg-config

I had no issues installing the binaries from the package manager, I confirmed they were on the path.

However the Python package still couldn't find them and searching in the pygraphviz GitHub issues I found this installion issue. The advice in that issue was to just add in install options from the command line. My heart immediately sank because I didn't know if this could be automated and I really hate manual requirement installs.

Thankfully since this pip PR you can specify install options in the requirements.txt file. So I did this as follows:

pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"

Now I get the install to work as intended without needing to do any manual steps for the python package installation.

Unfortunately I'll probably need to set something else up to make sure the system wide binaries are installed though.