Library not found with Layout.create_cell in KLayout 0.27+

edited May 2022 in Python scripting

I recently updated KLayout from 0.26.12 to 0.27.9 and found that every PCell that loads a cell from another library using Layout.create_cell(name,library_name) fails. The cell object that is returned is (nil) as if the library name is incorrect. I reinstalled KLayout 0.26.12 while keeping all other files the same and everything works again. Any ideas what may be causing this?

I did verify that the library was loaded with Library.library_names().

Comments

  • @steidlej I cannot confirm this isn't working anymore. This is a pretty basic feature and it's working fine for me. If the function returns nil, this may also indicate the cell name is not correct.

    The cells from your library - are those PCells? Maybe they are not set up properly in terms of default parameters so they don't instantiate without giving a parameter set?

    Can you reproduce the problem with a simple test case?

    Matthias

  • I also have similar issues. Just a few days ago, my script could work (this script is to instantiate pcell in for loop, with varying parameters). But since yesterday, the same script does not work. It return 'none' to the pcell declaration

  • Software doesn't simply stop working. It does not rust or break down. The feature is functional - there is at least one test among the ~2000 unit tests running on a regular basis on >10 platforms checking exactly that feature.

    I cannot debug your problem with such little information and an example demonstrating the problem. The function returns "none" on different occasions, specifically if an error is encountered during instantiation of the PCell. That are many reasons for PCell instantiation failing - API changes or configuration issues for example. You can check your logs for error messages which may give some hint about the root cause.

    Apart from that you can try running the test bench file (https://github.com/KLayout/klayout/blob/master/testdata/python/dbPCells.py) in order to check whether there is a general issue with your installation.

    Matthias

  • I imagine this might be something like a location that's not
    in the default search path, and maybe said default being
    overridden by the install process? That's not uncommon
    in the wider software world, sometimes you need to
    re-feather your nest (?). Maybe you set yourself up by
    removing some of the early-in-path config files (of which
    I gather there's multiple locations), but a fresh one in the
    prime location got written, and "took over"?

  • How did you solve this? I have the same issue now.

  • So your issue is that "software just stopped working"?

    Please read my messages above. This is ridiculous. I cannot help with such little information and without getting ANY feedback.

    Matthias

  • Sorry did not explain this clearly.

    The software did not just stop working - it is working fine.

    However, the script that we were using to generate cells using p-cells from a library does not recognize the library anymore after upgrading to Klayout 0.27+. With "Library.library_names()" it does point to the correct library however it does not insatiate the p-cells in the layout.

    If I try "type(mypcell)" it shows NoneType. If I try a previous version of Klayout (0.26.12) it works and that is why I believe this is due to the version change.

  • No sorry, I understood that.

    But what do you mean by type(mypcell)? "mypcell" comes from where?

    Sometimes things change between versions, for example deprecated methods may no longer be available or methods may behave differently. I cannot maintain exact backward compatibility always. I cannot tell you what to do if you don't give me details of what you are doing!

    And I have a number of tests which clearly show that the feature is still working.

    So please paste some minimal code that allows me to reproduce and debug the problem or at least explain in detail what you are doing. How do you register the library, how do you instantiate PCells etc. Code, not cloudy guesswork, please.

    Matthias

  • Maybe unrelated but I've been fighting some filesystem / mount point problems as I try to set up some new machines. There are some tools that will not "see" my /projects directory which is the second physical disk. And I'm not taking contrib brittleware, I mean LibreOffice, The GIMP.

    What I turned up is that this is install related. The fix for LibreOffice is to root out all the "snap" installation which they point you at, and pull the deb from their PPA repository.

    Seems much easier than simply not steering folks to a lame / wilfully blind installation.

    Evidently snap style installations don't let snap apps look at the full filesystem. Why, how, I didn't stick around to edumacate myself once I got to the fix .

    So anyway, might look at whether klayout file manager sees the lib, likewise any adjunct tools you may be invoking file operations through, because there's something rotten in install-land in this vein.
  • The GIMP, though, is what came on the Ubuntu Desktop 20.04LTS .iso - so I can't say that snap is the only method with the problem.

    Specifically internal file browser will not show /xxx (or others) while Linux shell and other utils, some other apps see and traverse just fine. This "whateveritis" also makes command line and icon invocations fail for can't-find.
Sign In or Register to comment.