It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
I tried to use Python module Nazca through Klayout; but I have a hard to make KL recognize the module. I get "Class moduleNotFoundError".
In my Pc Python, Anaconda, and Nazca are already installed; and can run Nazca from Jupyter.
As you may see, I can present the module from cmd window.
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
(base) C:>python
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
import nazca
INFO: index.py: Index models version: 0.5.13
nazca
module 'nazca' from 'C:\Users\osaydin\Anaconda3\lib\site-packages\nazca\__init__.py'
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
How can I make KL see the module?
Best regards,
Osman
Comments
Hi, Osman!
KLayout uses built-in Python interpreter. See documentation to learn how to specify additional paths or where to install packages.
Bad luck ... that's Windows again.
There is no package manager on Windows. Hence there is no way, KLayout can reliably link against some "system installation" of Python. KLayout uses the build chain from MSYS2, hence you can make Python modules visible, but the application will crash if they are build with anything else then MinGW gcc.
And yes I know there is vcpkg for example (https://github.com/microsoft/vcpkg), but they have chosen to use cmake and there is no Ruby there, so that's no way to go.
I have also tried to build against Anaconda, so at least there could be some coexistence, but I'm not really into debugging ABI incompatibilites, MSVC bugs and all that fancy DevOps stuff. If someone volunteers to maintain this deployment branch, you're welcome.
Matthias
Aha! Now I understand why they use it only on Spyder or Jupyter
Thanks anyway,
Osman
Hello,
On a very similar issue. I manage to add the python path of my Python installation and to get some python module. But as soon as Klayout encounter a .pyd it fails. Any idea ? is it even possible to load this type of file ?
I am working under window 10, looks like it's not helping.
Thanks,
Alexandre
No, you will not get a foreign Python module working unless it's binary-compatible KLayout DLLs. Conda Python modules will not work.
That's all painless on Linux.
Matthias
Thanks. By binary-compatible, you mean compile with the same dependency, compiler version and configuration ?
Alex