Author Topic: Trouble setting up python api  (Read 11415 times)

So after a ton of struggle, I think I finally managed to get pip to install the python api.

However, I'm still running into "module not found" whenever I try to call on it.  After a bunch of headache I discovered that designer is somehow using python 3.6 that's stored under plugins\pythonsdk.

I have python interpreter set up in preferences to point to python 2.7 which is what my project is using, but it's still not finding the pysbs modules.  Isn't the python interpreter supposed to take care of that?

Hi, have you found any solution on that?

SAT and Designer python API are two different things and different products. SD python API is directly embedded in the Designer installation so you have nothing to do. Whereas SAT is a bunch of different tools and can be used separately from Designer, it is designed to automate and implement a substance workflow (as an instance in a production pipeline). In this bunch there is a python pip package: pysbs I invite you to learn more about pip package which is one of standard python package form.

So one way to install pysbs package correctly is to use pip to install it in the python interpreter site-packages:
From a terminal or a Powershell:
Code: [Select]
pip install /satinstallpath/Python\ API/Pysbs-2019.3.1.zipThis instruction will install pysbs for your default system python interpreter.

If your purpose is to use pysbs from the Designer python interpreter you have to append your PYTHONPATH system variable
with the parent pysbs directory path.
- extract (as a classic way) the content of /satinstallpath/Python\ API/
- extraction result is a Pysbs-2019.3.1 directory
- append the path of this directory (Pysbs-2019.3.1) to the PYTHONPATH system variable
Another way (not really handy) is to append this parent directory (Pysbs-2019.3.1) directly in your python script thanks to:
Code: [Select]
import sys
sys.path.append("/satinstallpath/Python\ API/Pysbs-2019.3.1")
from pysbs import context

As you can see SAT deployment is very pipeline strategy dependent.

I hope these explanations clarified things.