Rory LayoutEditorReduced Wednesday 17th March 2021
Hello,
I am looking to use python to interface with LayoutEditor to help with semi-automated generation of chip layouts. I have access to a full license for LayoutEditor. I have successfully run the example script inside of the built in text editor. While this is quite useful, I would much prefer to write my code in an IDE, (in my case, VSCode or Atom). In the text editor, I'm not able to import modules that are present on my system install of python, so I guess that this is using a python .exe that is bundled with the software?
Is it possible to use this package with my own python environments? In particular, does anyone have experience setting this up with the Anaconda distribution?
I found[ this package](https://github.com/juspertor/LayoutScript_for_Python) which can be installed with pip to any environment, but it is unable to find the install of LayoutEditor in that case.
I have tried modifying Environment Variables also, but its not clear what they should be;
> LayoutScript for Python is available for Windows, Linux and Mac. It is included in the Windows packages, in all Linux packages and in the package for Mac OS systems. 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.
What are the correct values?
Any advice would be much appreciated.
Cheers!
Jürgen LayoutEditorFull Wednesday 17th March 2021
Hi,
Python module are sensitive to the used Python version. A (binary) module compiled for Python versiion X will not run with Python version Y. On Mac or Linux system you don't need to care this issue. The LayoutEditor always uses the Python version the system ships natively. So any IDE using the native Python installation is fine to use. Just PATH, LD_LIBRARY_PATH, PYTHONHOME and PYTHONPATH needs to be adjusted in a way that the LayoutEditor installation is found. There are no fixed values for these environment setting as it may depend on your system. To find the correct values I recommend to start a Python script from the build in TextEditor and read out these values.
On Windows it is totally different. Windows do not come with a Python installation. Any IDE available comes with its own Python version and mixing (binary) Python modules will get almost impossible. The only way to get it running is to find a IDE supporting the same Python version of your LayoutEditor installation. Alternative you need to switch the IDE to the Python package shipped with the LayoutEditor.
Daniel
Friday 30th April 2021
Hi Rory,
I spent some time trying to create a conda environment that could run LayoutScript, and I didn't succeed for the reasons Jürgen mentioned. Instead, I bootstrapped the Python install tools (setuptools and pip) in the Python distribution that comes with LayoutScript, used pip to install what I needed, and used the LayoutScript python.exe as the interpreter so that I could develop scripts in an IDE (I use PyCharm). This isn't quite as convenient as using (ana)conda, so I combined the steps in a script that has worked on Windows.
To see how to do this, check out the README.md and install.py files in the following package: [https://github.com/danielflanigan/layouteditor-wrapper](https://github.com/danielflanigan/layouteditor-wrapper)
(Jürgen, I hope you don't mind my posting this link here. Please delete if so.) Follow the instructions in README.md to install. This worked with LayoutScript distributions as of last year. Let me know if it works or if you have problems.
Daniel
Friday 30th April 2021
Hi Rory,
I spent some time trying to create a conda environment that could run LayoutScript, and I didn't succeed for the reasons Jürgen mentioned. Instead, I bootstrapped the Python install tools (setuptools and pip) in the Python distribution that comes with LayoutScript, used pip to install what I needed, and used the LayoutScript python.exe as the interpreter so that I could develop scripts in an IDE (I use PyCharm). This isn't quite as convenient as using (ana)conda, so I combined the steps in a script that has worked on Windows.
To see how to do this, check out the README.md and install.py files in the following package: [https://github.com/danielflanigan/layouteditor-wrapper](https://github.com/danielflanigan/layouteditor-wrapper)
(Jürgen, I hope you don't mind my posting this link here. Please delete if so.) Follow the instructions in README.md to install. This worked with LayoutScript distributions as of last year. Let me know if it works or if you have problems.
Daniel
Friday 30th April 2021
[Deleted accidental double post.]