Skip to content
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

KLayout macOS 29.7 Infinite window launch #1884

Open
Revenantx86 opened this issue Oct 9, 2024 · 14 comments
Open

KLayout macOS 29.7 Infinite window launch #1884

Revenantx86 opened this issue Oct 9, 2024 · 14 comments
Labels

Comments

@Revenantx86
Copy link

Hello,

I have recently installed klayout on my Mac and added sky130 libraries to do some layout.
However, when I launch the klayout after adding the library, klayout won't stop launching new window and eventually crashing my laptop. Is there a way to fix this issue. I believe the issue is from the pcells script that running with python and its just keeps lauching new klayout window. I have installed all libraries required.

Thanks

@klayoutmatthias
Copy link
Collaborator

I don't think this is a KLayout bug, so this may not be the right place to raise this question.

What exactly did you install? Specifically, from where and which version?

Matthias

@Revenantx86
Copy link
Author

I installed it using the DMG image from the website, and the SKY130 PDK is from the regular open_pdk repository. I added the SKY130 PDK using the technology package manager. Then I installed GDSFactory because the SKY130 library requires it for the PCells. However, to install GDSFactory, I used start-console.py since the Python version KLayout is using is different from the default version. After the installation, when I run the SKY130 scripts, it just keeps launching KLayout windows.

I am posting here because the same setup on my Linux machine doesn't produce this error, so I thought it could be related to KLayout.

Refik

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Oct 10, 2024

Hello,

Important

Please provide more info on your Mac, including the OS name and DMG you installed.

I'm a complete novice to the SKY130 PDK project.
Please kindly guide me step-by-step to reproduce your problem.
I have done the following so far.

On Linux Mint 20.3

1. Install Open-PDKs

git clone https://github.com/RTimothyEdwards/open_pdks.git
cd open_pdks
./configure [options]
make
[sudo] make install
  • In the configure stage, I got
checking for a Python interpreter with version >= 3.4... python3
checking for python3... /usr/local/bin/python3
checking for python3 version... 3.12
checking for python3 platform... linux
checking for python3 script directory... ${prefix}/lib/python3.12/site-packages
checking for python3 extension module directory... ${exec_prefix}/lib/python3.12/site-packages
checking python3 module: distutils... yes
checking for a sed that does not truncate output... /usr/bin/sed
configure: Found technology directories: gf180mcu sky130
Checking technology gf180mcu...
Checking technology sky130...
configure: Found tools: klayout magic netgen irsim openlane qflow xschem xcircuit
checking for magic... no
configure: error: You need 'magic' to generate the needed various cell views. <===

So I installed magic by:

$ sudo apt-get install magic

$ magic --version

8.2.157 <===

Important

Is the above version OK?
How did you install magic on your Mac? From Homebrew?

checking for a Python interpreter with version >= 3.4... python3
checking for python3... /usr/local/bin/python3
checking for python3 version... 3.12
checking for python3 platform... linux
checking for python3 script directory... ${prefix}/lib/python3.12/site-packages
checking for python3 extension module directory... ${exec_prefix}/lib/python3.12/site-packages
checking python3 module: distutils... yes
checking for a sed that does not truncate output... /usr/bin/sed
configure: Found technology directories: gf180mcu sky130
Checking technology gf180mcu...
Checking technology sky130...
configure: Found tools: klayout magic netgen irsim openlane qflow xschem xcircuit
checking for magic... /usr/bin/magic
checking for patch... /usr/bin/patch
configure: Package 'sky130_fd_pr' will be installed automatically during make.
configure: Package 'sky130_fd_io' will be installed automatically during make.
configure: Package 'sky130_fd_sc_hs' will be installed automatically during make.
configure: Package 'sky130_fd_sc_ms' will be installed automatically during make.
configure: Package 'sky130_fd_sc_ls' will be installed automatically during make.
configure: Package 'sky130_fd_sc_lp' will be installed automatically during make.
configure: Package 'sky130_fd_sc_hd' will be installed automatically during make.
configure: Package 'sky130_fd_sc_hdll' will be installed automatically during make.
configure: Package 'sky130_fd_sc_hvl' will be installed automatically during make.
configure: Package 'sky130_ml_xx_hd' will be installed automatically during make.
configure: Package 'xschem_sky130' will be installed automatically during make.
configure: Package 'klayout_sky130' will be installed automatically during make.
configure: Package 'precheck_sky130' will be installed automatically during make.
configure: Package 'sky130_sram_macros' will not be installed.
configure: Package 'sky130_fd_bd_sram' will not be installed.
configure: Package 'sky130_fd_pr_reram' will not be installed.
configure: Package 'sky130_osu_t12' will not be installed.
configure: Package 'sky130_osu_t15' will not be installed.
configure: Package 'sky130_osu_t18' will not be installed.
configure: Package 'gf180mcu_fd_pr' will be installed automatically during make.
configure: Package 'gf180mcu_fd_pv' will be installed automatically during make.
configure: Package 'gf180mcu_fd_io' will be installed automatically during make.
configure: Package 'gf180mcu_fd_sc_mcu7t5v0' will be installed automatically during make.
configure: Package 'gf180mcu_fd_sc_mcu9t5v0' will be installed automatically during make.
configure: Package 'gf180mcu_fd_ip_sram' will be installed automatically during make.
configure: Package 'gf180mcu_osu_sc' will be installed automatically during make.
configure: Tools enabled for PDK setup installation: klayout magic netgen irsim openlane qflow xschem xcircuit
configure: creating ./config.status
config.status: creating ../Makefile
config.status: creating ../gf180mcu/Makefile
config.status: creating ../sky130/Makefile
Build configured successfully
  • In the sudo make install stage, I got plenty of warnings like:
:
:
/home/sekigawa/GitWork/open_pdks/common/preproc.py:430: SyntaxWarning: invalid escape sequence '\g'
  pvalue = pvalue.replace(param, '\g<' + str(idx) + '>')
Common install:  Done.
Done.

Because I'm using the source-code-build Python 3.12.7+.

  • After installation...
LinuxMint{sekigawa}(1)$ pwd
/usr/local/share/pdk/scripts

LinuxMint{sekigawa}(2)$ ll
total 1080
 76 -rwxrwxr-x 1 root root  75988 Oct 10 13:02 cace.py*
  8 -rwxrwxr-x 1 root root   7181 Oct 10 13:02 cace_datasheet_upload.py*
 12 -rwxrwxr-x 1 root root   9431 Oct 10 13:02 cace_design_upload.py*
 96 -rwxrwxr-x 1 root root  95625 Oct 10 13:02 cace_gensim.py*
100 -rwxrwxr-x 1 root root 100819 Oct 10 13:02 cace_launch.py*
 12 -rwxrwxr-x 1 root root  10998 Oct 10 13:02 cace_makeplot.py*
 40 -rwxrwxr-x 1 root root  38491 Oct 10 13:02 cdl2spi.py*
  8 -rwxrwxr-x 1 root root   7800 Oct 10 13:02 change_gds_cell.py*
  8 -rwxrwxr-x 1 root root   4528 Oct 10 13:02 change_gds_date.py*
  8 -rwxrwxr-x 1 root root   6036 Oct 10 13:02 change_gds_string.py*
  4 -rwxrwxr-x 1 root root   2539 Oct 10 13:02 changepath.py*
  8 -rw-rw-r-- 1 root root   6987 Oct 10 13:02 characterize_help.txt
  4 -rwxrwxr-x 1 root root   3653 Oct 10 13:02 cleanup_unref.py*
  4 -rwxrwxr-x 1 root root   1862 Oct 10 13:02 consoletext.py*
  8 -rwxrwxr-x 1 root root   5828 Oct 10 13:02 create_project.py*
 28 -rwxrwxr-x 1 root root  26433 Oct 10 13:02 editparam.py*
 24 -rwxrwxr-x 1 root root  22987 Oct 10 13:02 failreport.py*
  4 -rwxrwxr-x 1 root root   4060 Oct 10 13:02 file_compressor.py*
  4 -rwxrwxr-x 1 root root   3217 Oct 10 13:02 find_gds_prefix.py*
  8 -rwxrwxr-x 1 root root   5015 Oct 10 13:02 foundry_nodes.py*
 12 -rwxrwxr-x 1 root root   8990 Oct 10 13:02 helpwindow.py*
  4 -rwxrwxr-x 1 root root   2107 Oct 10 13:02 listboxchoice.py*
  4 -rw-rw-r-- 1 root root    234 Oct 10 13:02 lvs_help.txt
 24 -rw-rw-r-- 1 root root  24320 Oct 10 13:02 make_icon_from_soft.py
  4 -rwxrwxr-x 1 root root   3841 Oct 10 13:02 makestub.py*
 12 -rw-rw-r-- 1 root root   9665 Oct 10 13:02 manager_help.txt
  4 -rwxrwxr-x 1 root root    323 Oct 10 13:02 natural_sort.py*
 16 -rwxrwxr-x 1 root root  13623 Oct 10 13:02 netlist_to_layout.py*
108 -rwxrwxr-x 1 root root 108579 Oct 10 13:02 padframe_generator.py*
 12 -rwxrwxr-x 1 root root  10104 Oct 10 13:02 profile.py*
192 -rwxrwxr-x 1 root root 196057 Oct 10 13:02 project_manager.py*
  4 -rw-rw-r-- 1 root root    234 Oct 10 13:02 qflow_help.txt
 12 -rwxrwxr-x 1 root root  11829 Oct 10 13:02 rename_project.py*
  8 -rwxrwxr-x 1 root root   5892 Oct 10 13:02 settings.py*
 16 -rwxrwxr-x 1 root root  15824 Oct 10 13:02 simhints.py*
108 -rwxrwxr-x 1 root root 108579 Oct 10 13:02 soc_floorplanner.py*
  4 -rw-rw-r-- 1 root root   3892 Oct 10 13:02 spice_model_red.py
 12 -rwxrwxr-x 1 root root   8287 Oct 10 13:02 spiceunits.py*
  4 -rwxrwxr-x 1 root root   3514 Oct 10 13:02 symbolbuilder.py*
  4 -rw-rw-r-- 1 root root   3814 Oct 10 13:02 textreport.py
  4 -rwxrwxr-x 1 root root   2390 Oct 10 13:02 tksimpledialog.py*
  8 -rwxrwxr-x 1 root root   7459 Oct 10 13:02 tooltip.py*
 12 -rwxrwxr-x 1 root root  11828 Oct 10 13:02 treeviewchoice.py*
 28 -rwxrwxr-x 1 root root  27140 Oct 10 13:02 treeviewsplit.py*

2. Install SKY130 PDK
gh-1884-01
gh-1884-02

3. Install GDSFactory 8.12.0

$ pip3 install gdsfactory

$ pip3 list | grep gds

gdsfactory           8.12.0 <===

(KLPy312) LinuxMint{sekigawa}(1)$ python3
Python 3.12.7+ (heads/3.12:79b4c9d99a0, Oct  8 2024, 08:16:52) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdsfactory

>>> gdsfactory.__file__
'/home/sekigawa/opt/KLPy312/lib/python3.12/site-packages/gdsfactory/__init__.py' <=== using a virtual env.
>>>

gh-1884-03

Important

How do I integrate the Open-PDKs scripts into the virtual environment?

To be continued...

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Oct 10, 2024

Cont.

I successfully cloned the five repositories below using SmartGit on Linux.

  1. https://github.com/FatsieFS/Salt-C4M_FlexLibs.git
  2. https://github.com/FatsieFS/Salt-C4M_PDK_Sky130
  3. https://github.com/FatsieFS/Salt-PDKMaster.git
  4. https://github.com/klayoutmatthias/sky130A_el.git
  5. https://github.com/klayoutmatthias/xsection.git
:
: my local git repos
:
 4 drwxrwxr-x  5 sekigawa sekigawa  4096 Oct 10 14:19 Salt-C4M_FlexLibs/
 4 drwxrwxr-x  7 sekigawa sekigawa  4096 Oct 10 14:20 Salt-C4M_PDK_Sky130/
 4 drwxrwxr-x  5 sekigawa sekigawa  4096 Oct 10 14:21 Salt-PDKMaster/
 4 drwxrwxr-x 10 sekigawa sekigawa  4096 Oct 10 14:25 sky130A_el/
 4 drwxrwxr-x  8 sekigawa sekigawa  4096 Oct 10 14:25 xsection/

Should I just create symbolic links to these directories from $HOME/.klayout/salt/?
If so, in what directory structure?

Note

My KLayout 0.29.7 (source-code-build) on Linux uses libgit2 1.8.1 (source-code-build).
The Windows binary seems to link libgit2 1.7.

I have rebuilt KLayout 0.29.7 with libgit2 1.7.2 (source-code-build). However, the problems reproduce.


  • Mac is OK!
    gh-1884-06
    gh-1884-07

  • Linux DEB pkg using libgit2 0.28.4 is also OK.
    gh-1884-08

@Revenantx86
Copy link
Author

Revenantx86 commented Oct 10, 2024

Hello, if you have installed the klayout on Mac can you try adding the sky130 library on the open_pdk. You can either build it form open_pdks or install quickly with efabless Volare. The existing packages on klayout are working on me as well but they are not complete, missing instances.

Or you can try to just install gf180 from package manager on klayout as well. I had the same issue with gf180.

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Oct 11, 2024

Hello @Revenantx86,

As seen above, I have resolved the package installation problem on Linux.
I have installed:

  1. Open-PDKs
  2. SKY130 PDK
  3. GDSFactory globally and locally (virtual environment); so either environment can be used

I believe my Linux setup is equivalent to yours.

I am posting here because the same setup on my Linux machine doesn't produce this error,
so I thought it could be related to KLayout.

The next step is to know your operation sequence on Linux, which DOES NOT produce the error.
In other words, your expected behaviors.
I will replay the same sequence on Linux first, then on Mac (I hope to try both next week).

However, to install GDSFactory, I used start-console.py since the Python version KLayout is using
is different from the default version.

From this description, I assume you are using one of HW-*.dmg, including Python 3.11.10. Please let me know if not.

After the installation, when I run the SKY130 scripts, it just keeps launching KLayout windows.

Please specify which scripts you ran.

Regards,
Kazzz-S

@klayoutmatthias
Copy link
Collaborator

Hi @Revenantx86,

before going too deep into debugging, you should try boiling down the problem.

My preferred way is use a fresh isolated environment. For Python that is a new virtual environment, for KLayout that is a new KLAYOUT_HOME.

First you need to identify the Python version you're using with the DMG. Under Linux that is always the system Python, under Mac there are different options. I am assuming you are using system Python.

To create a virtual environment I use:

python3 -m venv venv-test
. venv-test/bin/activate

If you a using a non-system Python with KLayout, replace "python3" by that Python interpreter.

Now you can install GDSFactory there. As you suggest, I am going to install "gf180mcu" which in the current 0.0.4 version is not compatible with GDSFactory 8. Hence I use version 7.27.1 which is the latest one of the 7 series:

pip3 install gdsfactory==7.27.1

To convince KLayout to use the virtual environment you need to point it to the virtual environment. First, you need to disable the system environment which the Python interpreter embedded into KLayout loads automatically. You can do so by setting KLAYOUT_PYTHONHOME to some non-existing directory, i.e. /dev/null.

We also need to copy the Python search path into KLAYOUT_PYTHONPATH.

So, inside the virtual environment do:

export KLAYOUT_PYTHONHOME=/dev/null
export KLAYOUT_PYTHONPATH=$(python3 -c "import sys; print(':'.join(sys.path))")

To use a fresh KLayout environment, you can use a new folder for KLAYOUT_HOME. For example:

rm -rf klayout-test
export KLAYOUT_HOME=$(pwd)/klayout-test

If you start KLayout now from the command line, you should see a blank environment. No packages loaded.

You can now install "gf180mcu" from the package manager in version 0.0.4. Exit KLayout and restart. Now GDSFactory will complete it's installation by adding some more packages. Make sure you do all of that from the virtual environment.

I am now able to draw layouts with KLayout using the GF180 device primitives. There is no effect of windows popping up on Linux. So far that is consistent.

Maybe you can repeat the same steps on MacOS to see if that recipe allows reproducing the problem.

Matthias

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Oct 15, 2024

Linux Mint 20.3

Hello @klayoutmatthias,

Thank you for the instructions.
On Linux Mint 20.3, I usually build KLayout from source code using Python 3.12.7+, also built from source code and installed in /usr/local/[bin|lib].
Below are the steps I followed.

1. Create a virtual environment

Mint203{sekigawa}(1)$ python3 -m venv $HOME/opt/KLPy312
Mint203{sekigawa}(2)$ source $HOME/opt/KLPy312/bin/activate

2. Install "gdsfactory"

(KLPy312) Mint203{sekigawa}(3)$ pip3 install gdsfactory==7.27.1

(KLPy312) Mint203{sekigawa}(4)$ pip3 list | grep factory
gdsfactory             7.27.1
kfactory               0.13.3

3. Use a fresh KLayout environment

(KLPy312) Mint203{sekigawa}(11)$ export VIRTUAL_ENV=$HOME/opt/KLPy312
(KLPy312) Mint203{sekigawa}(12)$ export KLAYOUT_PYTHONHOME=/dev/null
(KLPy312) Mint203{sekigawa}(13)$ export KLAYOUT_PYTHONPATH=$($VIRTUAL_ENV/bin/python3 -c "import sys; print(':'.join(sys.path))")

(KLPy312) Mint203{sekigawa}(14)$ \rm -rf klayout-test
(KLPy312) Mint203{sekigawa}(15)$ export KLAYOUT_HOME=$(pwd)/klayout-test
(KLPy312) Mint203{sekigawa}(16)$ klayout ===> started normally!

4. Install "gf180mcu" from the package manager in version 0.0.4

5. Draw layouts with KLayout using the GF180 device primitives
gh-1884-21

I have confirmed that multi-window popups do not occur on Linux in this case.
I will be conducting similar tests on Mac.

Best regards,
Kazzz-S

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Oct 15, 2024

macOS Sonoma with LW-klayout-0.29.7-macOS-Sonoma-1-qt6Brew-Rhb33Phb312.dmg

0. Install the DMG
LW-klayout-0.29.7-macOS-Sonoma-1-qt6Brew-Rhb33Phb312.dmg --- install ---> /Applications/klayout.app

1. Create a virtual environment

MacBookPro2{sekigawa} ~ (1)% which python3
/usr/local/opt/[email protected]/bin/python3 <=== Python 3.12.7 from Homebrew

MacBookPro2{sekigawa} ~ (2)% python3 -m venv $HOME/opt/HBPy312
MacBookPro2{sekigawa} ~ (3)% source $HOME/opt/HBPy312/bin/activate

2. Install "gdsfactory"

(HBPy312) MacBookPro2{sekigawa} ~ (4)% which pip3
/Users/sekigawa/opt/HBPy312/bin/pip3

(HBPy312) MacBookPro2{sekigawa} ~ (5)% pip3 list
Package Version
------- -------
pip     24.2

(HBPy312) MacBookPro2{sekigawa} ~ (6)% pip3 install gdsfactory==7.27.1

(HBPy312) MacBookPro2{sekigawa} ~ (7)% pip3 list | grep factory
gdsfactory             7.27.1
kfactory               0.13.3

3. Use a fresh KLayout environment

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (10)% pwd
/Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (11)% export VIRTUAL_ENV=$HOME/opt/HBPy312
(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (12)% export KLAYOUT_PYTHONHOME=/dev/null
(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (13)% export KLAYOUT_PYTHONPATH=$($VIRTUAL_ENV/bin/python3 -c "import sys; print(':'.join(sys.path))")

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (14)% \rm -rf klayout-test
(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (15)% export KLAYOUT_HOME=$(pwd)/klayout-test
(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (16)% open -a /Applications/klayout.app ===> started normally!

4. Install "gf180mcu" from the package manager in version 0.0.4

5. Draw layouts with KLayout using the GF180 device primitives
gh-1884-31

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (17)% pip3 list | grep factory
<!!! EMPTY !!!>

6. Re-install "gdsfactory==7.27.1" and restart the fresh KLayout

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (18)% pip3 install gdsfactory==7.27.1
(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (19)% pip3 list | grep factory
gdsfactory             7.27.1
kfactory               0.13.3

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (20)% /Applications/klayout.app/Contents/MacOS/klayout
:
:
Using cached ruamel.yaml.string-0.1.1-py3-none-any.whl (4.1 kB)
Installing collected packages: rectangle-packer, attrs, ruamel.yaml.string, kfactory, gdsfactory
  Attempting uninstall: kfactory
    Found existing installation: kfactory 0.13.3
    Uninstalling kfactory-0.13.3:
      Successfully uninstalled kfactory-0.13.3 <=== ??? Why ???
  Attempting uninstall: gdsfactory
    Found existing installation: gdsfactory 7.27.1
    Uninstalling gdsfactory-7.27.1:
      Successfully uninstalled gdsfactory-7.27.1 <=== ??? Why ???
Successfully installed attrs-24.2.0 gdsfactory-8.13.3 kfactory-0.21.0 rectangle-packer-2.0.2 ruamel.yaml.string-0.1.1
===> ERROR: /Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/salt/gf180mcu/pymacros/cells/draw_fet.py:22: ModuleNotFoundError: No module named 'gdsfactory'
  /Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/salt/gf180mcu/pymacros/cells/draw_fet.py:22
  /Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/salt/gf180mcu/pymacros/cells/fet.py:19
  /Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/salt/gf180mcu/pymacros/cells/__init__.py:21
  /Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/salt/gf180mcu/pymacros/gf180mcu.lym:12 (class ModuleNotFoundError)

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (21)% pip3 list | grep factory
<!!! EMPTY !!!>

7. Re-install "gdsfactory(==8.13.3)" and restart the fresh KLayout

(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (31)% pip3 install gdsfactory
(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (32)% pip3 list | grep factory
gdsfactory             8.13.3
kfactory               0.21.0
:
:
(HBPy312) MacBookPro2{sekigawa} macOS-Sonoma-LW (33)% /Applications/klayout.app/Contents/MacOS/klayout
  • I think I was able to reproduce the original problem.
gh-1884-LW-phb312.mp4

Best regards,
Kazzz-S

@Revenantx86
Copy link
Author

@Kazzz-S
Oh sorry to crash your computer 🤣 I have also found solution to infinite launch so if you change the autorun on gfu180m.lym to false it won't try to run script again and again. Or you can just remove the .klayout folder on safe mode.

From what I understood when the klayout is first opened automatically runs the script but the script launches another klayout which runs the script again, and eventually causing this. Im still trying to figure out the exact code that causes this.

Screenshot 2024-10-13 at 11 31 34 PM

@klayoutmatthias
Copy link
Collaborator

Hi @Kazzz-S Thanks for the analysis!

From what I see there is not much inside that file:

import sys
import os
import pip

pip.main(['install', 'gdsfactory', '--upgrade'])

technology_macros_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, technology_macros_path)

from cells import gf180mcu

# Instantiate and register the library
gf180mcu()


print("## gf180mcu PDK Pcells loaded.")
print(sys.path)

The only thing which is kind of suspicious is the "pip install" call. Could you try commenting it out, like this:

# pip.main(['install', 'gdsfactory', '--upgrade'])

I even think that is a general problem as gf180mcu is pinned to an older version of gdsfactory.

Does the problem occur again if you set "autorun" back to "true"? If not, I must conclude that "pip install gdsfactory --upgrade" does some strange things which in the end call KLayout on MacOS only.

Best regards,

Matthias

@klayoutmatthias
Copy link
Collaborator

klayoutmatthias commented Oct 15, 2024

I should add that for some reason gf180mcu needs an older version of gdsfactory. I assume their API evolved in an incompatible way. So you need to install 7.27.1 to run gf180mcu.

The best I guess was to update gf180mcu to support gdsfactory 8 (and later) too.

Matthias

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Oct 16, 2024

Hello @klayoutmatthias,

Thank you for the hints.
gh-1884-33a
gh-1884-33b

(3) I ran the macro manually in the IDE to make the "gf180mcu" library available.
Then, the second KLayout in the viewer mode launches at the first import gdsfactory.
gh-1884-33c
gh-1884-33d
gh-1884-33e
If autorun==true, the the whole process is recursive. Hence, the problematic behavior!

(4) I closed the second KLayout to proceed. Then, the "gf180mcu" library is ready.
gh-1884-33f


[IDE Console]

Running macro /Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/salt/gf180mcu/pymacros/gf180mcu.lym
(22, 0)
## gf180mcu PDK Pcells loaded.
['/Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/salt/gf180mcu/pymacros', '/Applications/klayout.app/Contents/Frameworks/pymod', '/', '/usr/local/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python312.zip', '/usr/local/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12', '/usr/local/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload', '/Users/sekigawa/opt/HBPy312/lib/python3.12/site-packages', '/dev/null/lib/python312.zip', '/dev/null/lib/python3.12', '/dev/null/lib/python3.12/lib-dynload', '/Users/sekigawa/GitWork/ForumKLayout/GitHub/GitHub1884/macOS-Sonoma-LW/klayout-test/python']

I'll investigate more.
Best regards,
Kazzz-S


Direct import in Homebrew

[Added: 2024-10-19]

gh-1884-34a
gh-1884-34b
gh-1884-34c

@Kazzz-S
Copy link
Contributor

Kazzz-S commented Oct 21, 2024

Cont.

I started KLayout by /Applications/klayout-HB.app/Contents/MacOS/klayout -d 100 2>&1 | tee d100.log.
Then, import gdsfactory was used as shown in Direct import in Homebrew above.
The log message tells that...

:
:
/usr/local/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/\
lib/python3.12/multiprocessing/resource_tracker.py:123: \
UserWarning: resource_tracker: process died unexpectedly, relaunching.  Some resources might leak.
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  warnings.warn('resource_tracker: process died unexpectedly, '

I think this AND autorun==true are the root causes of this infinite-launching problem, not a KLayout issue.
Is gdsfactory designed for macOS to begin with?

Best regards,
Kazzz-S
d-100.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants