-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consistent python packages installation #1177
Comments
I don't think tech.lyt is the right place as it is intended to dynamically switch technologies and even have different technologies loaded at the same time. I'm not sure I understand what you want to achieve: do you want to run KLayout in the context of a certain PDK and load PDK-specific Python modules? In that case, you can simply set the KLAYOUT_PYTHONPATH environment variable to point to the location of your PDK-specific libraries. This variable acts like PYTHONPATH, but was renamed because users encountered conflicts with third-party tools using PYTHONPATH. If you want to run KLayout in an isolated context, you can also set the KLAYOUT_HOME environment variable which lets KLayout use this directory for configuration files and script location. Once you set KLAYOUT_HOME and KLAYOUT_PYTHONPATH, you are in full control over the files KLayout reads. Additionally, here is the explanation how packages and technologies interact with Python:
But packages and technologies do not establish an "application context" but rather modular extensions which can be added, removed or (in case of technologies) activated for specific views. Matthias |
Hi Matthias, When using the KLAYOUT_PYTHONPATH environment variable, and open KLayout it seems to be appending "/python" to every path I include:
In KLayout's macro development window, sys.path then returns:
Hence why the macro script @joamatab referenced does essentially the same thing, but without appending "/python" to the paths. Is there a way to just pull in the plain paths? |
I don't know why Py_SetPath does, but there is nothing that makes KLayout append "python" to the path (pya.cc, line 301++):
I also can't confirm that "python" is appended (mine is system python3 on Ubuntu-22). Matthias |
Ah so it looks like it adds the paths both with and without the "python" bit appended actually (on Debian Testing). |
No ... it doesn't. No "python" added. But: KLayout adds additional paths. Namely:
I assume this is what happens to you. If you want to avoid that, I suggest to use
Kind regards, Matthias |
What's the recommended way to register python packages inside klayout's python?
We are using a script
that requires you to manually specify your
lib/python
locationWhere could we store some information like this for each PDK? Maybe in the
tech.lyt
?Ideally, one day we can build klayout GUI from conda in Linux, MacOs and Linux and then use the conda packages for this
The text was updated successfully, but these errors were encountered: