Including sgtk on local event watcher

My event watcher doesn’t seem to know where to find the sgtk module. I can find plenty of resources on how to use the sgtk module, but not how to install that module on anywhere outside the project configs where Tank is. Is there a way to install it on a local python installation? There doesn’t seem to be a pip command from what I can see.

The simplest way is to clone the core repo and add it to sys path
git clone https://github.com/shotgunsoftware/tk-core.git
Then
sys.path.append("path-to-core/python")

You can actually install it using pip like so:

pip install git+https://github.com/shotgunsoftware/tk-core@v0.18.35

See more info in the docs:
https://developers.shotgridsoftware.com/tk-core/bootstrap.html#installing-the-sgtk-module-using-pip

was able to solve the issue with cloning and appending to sys path, but ran into some issues when doing things across projects (watcher didn’t like using other project’s toolkits). But, I managed to fix this as well via a thread I managed to find: Help

Use the ToolkitManager to avoid these issues - you have one global object, from which you can instantiate a toolkit for any project.
https://developers.shotgridsoftware.com/tk-core/bootstrap.html#bootstrapping-toolkit

1 Like