Setting for default KLAYOUT_PYTHONPATH


I have a problem with the python default path for modules under linux, in particular Debian bullseye/testing (though I had the same problem before upgrading from buster/stable to testing).

The problem:
I have two debian systems (both bullseye). I have compiled KLayout for both systems, because Debian now ships with python 3.7 and not 3.6 anymore. After compiling KLayout, on one system the path /usr/lib/python3/dist-packages is in the default path of python in KLayout, on the other one it is missing. Therefore, I am missing a lot of python packages in KLayout which are available in the system interpreter, mainly numpy. I assume this is in a configuration file and not set during compilation, but I am unable to find where it is set. I assume it is not set during compilation, because I can copy the working binary to the non-working system and it still failse.

I can manually bind it by either copying the original PYTHONPATH of the python3 environment or adding it manually to sys.path

Where is the default path set or loaded from?



  • Hi Sebastian,

    the default path is determined by Python itself. There is little KLayout does except adding "$KLAYOUT_PYTHONPATH" and disabling "$PYTHONHOME".

    I think this is the default path compiled into the Python you used to build KLayout against. If your systems are that different I'm afraid the best solution is to provide different KLayout builds for them. This will also avoid API compatibility issues.


Sign In or Register to comment.