KLayout / klayout

KLayout Main Sources
http://www.klayout.org
GNU General Public License v3.0
782 stars 200 forks source link

ImportError: cannot import name '__version__' from 'klayout' #1774

Closed Br1tt21 closed 3 months ago

Br1tt21 commented 3 months ago

When running KLayout with SKY130 library loaded (installed via built-in package manager), following error was thrown: ERROR: ImportError: cannot import name '__version__' from 'klayout' (/usr/lib/pymod/klayout/__init__.py) Resolved it by manually adding __version__ = "0.29.2" to the file. Pretty sure the specific number didn't really matter, because I'm using KLayout version 0.29.0.

KLayout is installed via Arch repository. Not sure if this issue belongs here, at the packager or somewhere else. If that's the case please let me know!

klayoutmatthias commented 3 months ago

Which SKY130 library are you referring to? There are multiple projects.

__version__ is supported, but not from the klayout module. klayout.db.__version__ works. There is a difference between the standalone Python module (which supports klayout.__version__).

I can fix that, but for backward compatibility, the library package should check klayout.db.__version__, not klayout.__version__.

A quick workaround is:

import klayout
klayout.__version__ = klayout.db.__version__

Matthias