How to run python package in pre-receive hook

How do I install a python package on a Gitlab self-hosted instance so that gitaly can run it as part of a pre-receive hook? I’ve tried modifying the path variable within the script. I’ve installed the python package as sudo. Regardless, I get exit codes: 127.

The only way I’ve been able to successfully get this to work is to use the path to the library as in: