Support Forum

LayoutScript module in Conda Environment

Kai

Saturday 29th July 2023
Hello, I would like to use the LayoutScript module in a conda environment. Following the manual: "LayoutScript for Python is available for Windows [...]. To use LayoutScript from outside the LayoutEditor set the enviourment variables PATH, LD_LIBRARY_PATH, PYTHONHOME and PYTHONPATH to the correct values before starting python." I used the integrated TextEditor to read out the paths. The conda environment I created uses the python version matching the LayoutEditor one. I tried getting it to work but did not succeed, also using some forum threads here but they were several years old. My question therefore is: is it at the moment possible to get the LayoutScript working in a conda environment? And if it is possible, how to succesfully set the correct paths? Would be happy to receive any feedback. Best regards, Kai
Jürgen
LayoutEditorFull
Tuesday 5th September 2023
Hi Kai, I don't have a system with conda to check that. LayoutScript is an binary extension for Python. Binary extensions are sensitive to the correct Python version and in same case to the used compiler when creating Python. If you set PATH, LD_LIBRARY_PATH, PYTHONHOME and PYTHONPATH identical to the values used by the LayoutEditor, you will use the Python package shipped with the LayoutEditor and not the one from conda. So some Python paths needs to be adjusted. In case you start Python with the option *-vvv* Python will print out a detailed error message and debug information that may help you to find the problem. Most likely the problem occur when importing LayoutScipt. To get this Python line working the path of the files LayoutScript.pyw and LayoutScript.pyd muss be includes in the PYTHONPATH setting. The LayoutEditor/bin path must be included in the PATH environment. But as mentioned before the PYTHON debug option *-vvvv* will give you more information on the problem.