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

installation on Python in KLayout #2902

Open
lukasc-ubc opened this issue Jun 22, 2024 · 9 comments
Open

installation on Python in KLayout #2902

lukasc-ubc opened this issue Jun 22, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@lukasc-ubc
Copy link
Contributor

Describe the bug

I am trying to install gdsfactory in KLayout, and I get error below. This is on KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311. Perhaps one of the gdsfactory dependancies does not want to install. There are many successful dependancy installations.

Is it possible to have an installation config option that skips some of the dependancies that fail?

Any idea how to fix it?

thank you

> import sys
> sys.version
'3.11.9 (main, Apr  2 2024, 16:31:10) [Clang 14.0.0 (clang-1400.0.29.202)]'
> from SiEPIC import install
> install.install('gdsfactory')
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
Collecting gdsfactory
  Downloading gdsfactory-8.2.3-py3-none-any.whl.metadata (11 kB)
Collecting jinja2<4 (from gdsfactory)
  Downloading jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting loguru<1 (from gdsfactory)
  Using cached loguru-0.7.2-py3-none-any.whl.metadata (23 kB)
Requirement already satisfied: matplotlib<4 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from gdsfactory) (3.9.0)
Requirement already satisfied: numpy<2 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from gdsfactory) (1.26.4)
Collecting omegaconf<3 (from gdsfactory)
  Using cached omegaconf-2.3.0-py3-none-any.whl.metadata (3.9 kB)
Collecting orjson<4 (from gdsfactory)
  Downloading orjson-3.10.5-cp311-cp311-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl.metadata (49 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.7/49.7 kB 1.4 MB/s eta 0:00:00
Requirement already satisfied: pandas<3 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from gdsfactory) (2.2.2)
Collecting pydantic<2.8,>=2 (from gdsfactory)
  Downloading pydantic-2.7.4-py3-none-any.whl.metadata (109 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.4/109.4 kB 3.1 MB/s eta 0:00:00
Collecting pydantic-settings<3 (from gdsfactory)
  Downloading pydantic_settings-2.3.3-py3-none-any.whl.metadata (3.3 kB)
Collecting pydantic-extra-types<3 (from gdsfactory)
  Downloading pydantic_extra_types-2.8.2-py3-none-any.whl.metadata (3.2 kB)
Requirement already satisfied: pyyaml in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from gdsfactory) (6.0.1)
Collecting qrcode (from gdsfactory)
  Using cached qrcode-7.4.2-py3-none-any.whl.metadata (17 kB)
Collecting rectpack<1 (from gdsfactory)
  Using cached rectpack-0.2.2-py3-none-any.whl
Requirement already satisfied: rich<14 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from gdsfactory) (13.7.1)
Requirement already satisfied: scipy<2 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from gdsfactory) (1.13.1)
Collecting shapely<3 (from gdsfactory)
  Downloading shapely-2.0.4-cp311-cp311-macosx_10_9_x86_64.whl.metadata (7.0 kB)
Collecting toolz<1 (from gdsfactory)
  Using cached toolz-0.12.1-py3-none-any.whl.metadata (5.1 kB)
Collecting types-PyYAML (from gdsfactory)
  Using cached types_PyYAML-6.0.12.20240311-py3-none-any.whl.metadata (1.5 kB)
Collecting typer<1 (from gdsfactory)
  Downloading typer-0.12.3-py3-none-any.whl.metadata (15 kB)
Requirement already satisfied: watchdog<5 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from gdsfactory) (4.0.1)
Collecting kfactory==0.17.3 (from kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading kfactory-0.17.3-py3-none-any.whl.metadata (4.5 kB)
Collecting freetype-py (from gdsfactory)
  Using cached freetype_py-2.4.0-py3-none-macosx_10_9_universal2.whl.metadata (6.3 kB)
Collecting mapbox_earcut (from gdsfactory)
  Downloading mapbox_earcut-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl.metadata (2.0 kB)
Collecting networkx (from gdsfactory)
  Downloading networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting scikit-image (from gdsfactory)
  Downloading scikit_image-0.24.0-cp311-cp311-macosx_10_9_x86_64.whl.metadata (14 kB)
Collecting trimesh<4.4,>=4 (from gdsfactory)
  Downloading trimesh-4.3.2-py3-none-any.whl.metadata (18 kB)
Collecting ipykernel (from gdsfactory)
  Downloading ipykernel-6.29.4-py3-none-any.whl.metadata (6.3 kB)
Collecting klayout>=0.29.1 (from kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading klayout-0.29.2-cp311-cp311-macosx_10_9_x86_64.whl.metadata (782 bytes)
Collecting ruamel.yaml (from kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached ruamel.yaml-0.18.6-py3-none-any.whl.metadata (23 kB)
Collecting cachetools>=5.2.0 (from kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached cachetools-5.3.3-py3-none-any.whl.metadata (5.3 kB)
Collecting gitpython (from kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading GitPython-3.1.43-py3-none-any.whl.metadata (13 kB)
Collecting tomli (from kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached tomli-2.0.1-py3-none-any.whl.metadata (8.9 kB)
Requirement already satisfied: requests in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory) (2.31.0)
Collecting aenum (from kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached aenum-3.1.15-py3-none-any.whl.metadata (3.7 kB)
Collecting ipython (from kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading ipython-8.25.0-py3-none-any.whl.metadata (4.9 kB)
Collecting ipywidgets (from kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading ipywidgets-8.1.3-py3-none-any.whl.metadata (2.4 kB)
Collecting ipytree (from kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached ipytree-0.2.2-py2.py3-none-any.whl.metadata (849 bytes)
Collecting ipyevents (from kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached ipyevents-2.0.2-py3-none-any.whl.metadata (2.9 kB)
Collecting MarkupSafe>=2.0 (from jinja2<4->gdsfactory)
  Downloading MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl.metadata (3.0 kB)
Requirement already satisfied: contourpy>=1.0.1 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (1.2.1)
Requirement already satisfied: cycler>=0.10 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (4.53.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (1.4.5)
Requirement already satisfied: packaging>=20.0 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (23.2)
Requirement already satisfied: pillow>=8 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (10.3.0)
Requirement already satisfied: pyparsing>=2.3.1 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from matplotlib<4->gdsfactory) (2.8.2)
Collecting antlr4-python3-runtime==4.9.* (from omegaconf<3->gdsfactory)
  Using cached antlr4_python3_runtime-4.9.3-py3-none-any.whl
Requirement already satisfied: pytz>=2020.1 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from pandas<3->gdsfactory) (2023.3.post1)
Requirement already satisfied: tzdata>=2022.7 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from pandas<3->gdsfactory) (2023.4)
Collecting annotated-types>=0.4.0 (from pydantic<2.8,>=2->gdsfactory)
  Using cached annotated_types-0.7.0-py3-none-any.whl.metadata (15 kB)
Collecting pydantic-core==2.18.4 (from pydantic<2.8,>=2->gdsfactory)
  Downloading pydantic_core-2.18.4-cp311-cp311-macosx_10_12_x86_64.whl.metadata (6.5 kB)
Collecting typing-extensions>=4.6.1 (from pydantic<2.8,>=2->gdsfactory)
  Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting python-dotenv>=0.21.0 (from pydantic-settings<3->gdsfactory)
  Using cached python_dotenv-1.0.1-py3-none-any.whl.metadata (23 kB)
Requirement already satisfied: markdown-it-py>=2.2.0 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from rich<14->gdsfactory) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from rich<14->gdsfactory) (2.18.0)
Collecting click>=8.0.0 (from typer<1->gdsfactory)
  Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting shellingham>=1.3.0 (from typer<1->gdsfactory)
  Using cached shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting appnope (from ipykernel->gdsfactory)
  Using cached appnope-0.1.4-py2.py3-none-any.whl.metadata (908 bytes)
Collecting comm>=0.1.1 (from ipykernel->gdsfactory)
  Using cached comm-0.2.2-py3-none-any.whl.metadata (3.7 kB)
Collecting debugpy>=1.6.5 (from ipykernel->gdsfactory)
  Using cached debugpy-1.8.1-cp311-cp311-macosx_11_0_universal2.whl.metadata (1.1 kB)
Collecting jupyter-client>=6.1.12 (from ipykernel->gdsfactory)
  Downloading jupyter_client-8.6.2-py3-none-any.whl.metadata (8.3 kB)
Collecting jupyter-core!=5.0.*,>=4.12 (from ipykernel->gdsfactory)
  Using cached jupyter_core-5.7.2-py3-none-any.whl.metadata (3.4 kB)
Collecting matplotlib-inline>=0.1 (from ipykernel->gdsfactory)
  Downloading matplotlib_inline-0.1.7-py3-none-any.whl.metadata (3.9 kB)
Collecting nest-asyncio (from ipykernel->gdsfactory)
  Using cached nest_asyncio-1.6.0-py3-none-any.whl.metadata (2.8 kB)
Collecting psutil (from ipykernel->gdsfactory)
  Downloading psutil-6.0.0-cp36-abi3-macosx_10_9_x86_64.whl.metadata (21 kB)
Collecting pyzmq>=24 (from ipykernel->gdsfactory)
  Downloading pyzmq-26.0.3-cp311-cp311-macosx_10_15_universal2.whl.metadata (6.1 kB)
Collecting tornado>=6.1 (from ipykernel->gdsfactory)
  Downloading tornado-6.4.1-cp38-abi3-macosx_10_9_x86_64.whl.metadata (2.5 kB)
Collecting traitlets>=5.4.0 (from ipykernel->gdsfactory)
  Downloading traitlets-5.14.3-py3-none-any.whl.metadata (10 kB)
Collecting pypng (from qrcode->gdsfactory)
  Using cached pypng-0.20220715.0-py3-none-any.whl.metadata (13 kB)
Collecting imageio>=2.33 (from scikit-image->gdsfactory)
  Downloading imageio-2.34.1-py3-none-any.whl.metadata (4.9 kB)
Collecting tifffile>=2022.8.12 (from scikit-image->gdsfactory)
  Downloading tifffile-2024.6.18-py3-none-any.whl.metadata (31 kB)
Collecting lazy-loader>=0.4 (from scikit-image->gdsfactory)
  Downloading lazy_loader-0.4-py3-none-any.whl.metadata (7.6 kB)
Collecting decorator (from ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached decorator-5.1.1-py3-none-any.whl.metadata (4.0 kB)
Collecting jedi>=0.16 (from ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached jedi-0.19.1-py2.py3-none-any.whl.metadata (22 kB)
Collecting prompt-toolkit<3.1.0,>=3.0.41 (from ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading prompt_toolkit-3.0.47-py3-none-any.whl.metadata (6.4 kB)
Collecting stack-data (from ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached stack_data-0.6.3-py3-none-any.whl.metadata (18 kB)
Collecting pexpect>4.3 (from ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached pexpect-4.9.0-py2.py3-none-any.whl.metadata (2.5 kB)
Collecting platformdirs>=2.5 (from jupyter-core!=5.0.*,>=4.12->ipykernel->gdsfactory)
  Downloading platformdirs-4.2.2-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: mdurl~=0.1 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from markdown-it-py>=2.2.0->rich<14->gdsfactory) (0.1.2)
Requirement already satisfied: six>=1.5 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from python-dateutil>=2.7->matplotlib<4->gdsfactory) (1.16.0)
Collecting gitdb<5,>=4.0.1 (from gitpython->kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached gitdb-4.0.11-py3-none-any.whl.metadata (1.2 kB)
Collecting widgetsnbextension~=4.0.11 (from ipywidgets->kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading widgetsnbextension-4.0.11-py3-none-any.whl.metadata (1.6 kB)
Collecting jupyterlab-widgets~=3.0.11 (from ipywidgets->kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading jupyterlab_widgets-3.0.11-py3-none-any.whl.metadata (4.1 kB)
Requirement already satisfied: charset-normalizer<4,>=2 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from requests->kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from requests->kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from requests->kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in /Users/lukasc/Library/Python/3.11/lib/python/site-packages (from requests->kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory) (2023.11.17)
Collecting ruamel.yaml.clib>=0.2.7 (from ruamel.yaml->kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl.metadata (2.2 kB)
WARNING: typer 0.12.3 does not provide the extra 'all'
Collecting smmap<6,>=3.0.1 (from gitdb<5,>=4.0.1->gitpython->kfactory==0.17.3->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached smmap-5.0.1-py3-none-any.whl.metadata (4.3 kB)
Collecting parso<0.9.0,>=0.8.3 (from jedi>=0.16->ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Downloading parso-0.8.4-py2.py3-none-any.whl.metadata (7.7 kB)
Collecting ptyprocess>=0.5 (from pexpect>4.3->ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached ptyprocess-0.7.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting wcwidth (from prompt-toolkit<3.1.0,>=3.0.41->ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached wcwidth-0.2.13-py2.py3-none-any.whl.metadata (14 kB)
Collecting executing>=1.2.0 (from stack-data->ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached executing-2.0.1-py2.py3-none-any.whl.metadata (9.0 kB)
Collecting asttokens>=2.1.0 (from stack-data->ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached asttokens-2.4.1-py2.py3-none-any.whl.metadata (5.2 kB)
Collecting pure-eval (from stack-data->ipython->kfactory[git,ipy]==0.17.3->gdsfactory)
  Using cached pure_eval-0.2.2-py3-none-any.whl.metadata (6.2 kB)
Downloading gdsfactory-8.2.3-py3-none-any.whl (636 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 636.2/636.2 kB 12.5 MB/s eta 0:00:00
Downloading kfactory-0.17.3-py3-none-any.whl (141 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 141.7/141.7 kB 7.4 MB/s eta 0:00:00
Downloading jinja2-3.1.4-py3-none-any.whl (133 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.3/133.3 kB 9.0 MB/s eta 0:00:00
Using cached loguru-0.7.2-py3-none-any.whl (62 kB)
Using cached omegaconf-2.3.0-py3-none-any.whl (79 kB)
Downloading orjson-3.10.5-cp311-cp311-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl (258 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 258.7/258.7 kB 7.2 MB/s eta 0:00:00
Downloading pydantic-2.7.4-py3-none-any.whl (409 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 409.0/409.0 kB 12.1 MB/s eta 0:00:00
Downloading pydantic_core-2.18.4-cp311-cp311-macosx_10_12_x86_64.whl (1.9 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 20.4 MB/s eta 0:00:00
Downloading pydantic_extra_types-2.8.2-py3-none-any.whl (27 kB)
Downloading pydantic_settings-2.3.3-py3-none-any.whl (22 kB)
Downloading shapely-2.0.4-cp311-cp311-macosx_10_9_x86_64.whl (1.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 23.4 MB/s eta 0:00:00
Using cached toolz-0.12.1-py3-none-any.whl (56 kB)
Downloading trimesh-4.3.2-py3-none-any.whl (693 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 693.9/693.9 kB 15.8 MB/s eta 0:00:00
Downloading typer-0.12.3-py3-none-any.whl (47 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.2/47.2 kB 3.2 MB/s eta 0:00:00
Using cached freetype_py-2.4.0-py3-none-macosx_10_9_universal2.whl (1.8 MB)
Downloading ipykernel-6.29.4-py3-none-any.whl (117 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.1/117.1 kB 4.5 MB/s eta 0:00:00
Downloading mapbox_earcut-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl (75 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.6/75.6 kB 3.1 MB/s eta 0:00:00
Downloading networkx-3.3-py3-none-any.whl (1.7 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 30.5 MB/s eta 0:00:00
Using cached qrcode-7.4.2-py3-none-any.whl (46 kB)
Downloading scikit_image-0.24.0-cp311-cp311-macosx_10_9_x86_64.whl (14.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 34.9 MB/s eta 0:00:00
Using cached types_PyYAML-6.0.12.20240311-py3-none-any.whl (15 kB)
Using cached annotated_types-0.7.0-py3-none-any.whl (13 kB)
Using cached cachetools-5.3.3-py3-none-any.whl (9.3 kB)
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Using cached comm-0.2.2-py3-none-any.whl (7.2 kB)
Using cached debugpy-1.8.1-cp311-cp311-macosx_11_0_universal2.whl (1.8 MB)
Downloading imageio-2.34.1-py3-none-any.whl (313 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 313.5/313.5 kB 15.7 MB/s eta 0:00:00
Downloading ipython-8.25.0-py3-none-any.whl (817 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 817.3/817.3 kB 26.8 MB/s eta 0:00:00
Downloading jupyter_client-8.6.2-py3-none-any.whl (105 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 105.9/105.9 kB 6.1 MB/s eta 0:00:00
Using cached jupyter_core-5.7.2-py3-none-any.whl (28 kB)
Downloading klayout-0.29.2-cp311-cp311-macosx_10_9_x86_64.whl (18.6 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.6/18.6 MB 13.3 MB/s eta 0:00:00
Downloading lazy_loader-0.4-py3-none-any.whl (12 kB)
Downloading MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl (14 kB)
Downloading matplotlib_inline-0.1.7-py3-none-any.whl (9.9 kB)
Using cached python_dotenv-1.0.1-py3-none-any.whl (19 kB)
Downloading pyzmq-26.0.3-cp311-cp311-macosx_10_15_universal2.whl (1.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 20.7 MB/s eta 0:00:00
Using cached shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Downloading tifffile-2024.6.18-py3-none-any.whl (226 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 226.0/226.0 kB 8.2 MB/s eta 0:00:00
Downloading tornado-6.4.1-cp38-abi3-macosx_10_9_x86_64.whl (433 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 433.9/433.9 kB 15.2 MB/s eta 0:00:00
Downloading traitlets-5.14.3-py3-none-any.whl (85 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.4/85.4 kB 4.3 MB/s eta 0:00:00
Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Using cached aenum-3.1.15-py3-none-any.whl (137 kB)
Using cached appnope-0.1.4-py2.py3-none-any.whl (4.3 kB)
Downloading GitPython-3.1.43-py3-none-any.whl (207 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 207.3/207.3 kB 9.7 MB/s eta 0:00:00
Using cached ipyevents-2.0.2-py3-none-any.whl (101 kB)
Downloading ipywidgets-8.1.3-py3-none-any.whl (139 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 139.4/139.4 kB 7.3 MB/s eta 0:00:00
Using cached ipytree-0.2.2-py2.py3-none-any.whl (1.3 MB)
Using cached nest_asyncio-1.6.0-py3-none-any.whl (5.2 kB)
Downloading psutil-6.0.0-cp36-abi3-macosx_10_9_x86_64.whl (250 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 251.0/251.0 kB 11.5 MB/s eta 0:00:00
Using cached pypng-0.20220715.0-py3-none-any.whl (58 kB)
Using cached ruamel.yaml-0.18.6-py3-none-any.whl (117 kB)
Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Using cached gitdb-4.0.11-py3-none-any.whl (62 kB)
Using cached jedi-0.19.1-py2.py3-none-any.whl (1.6 MB)
Downloading jupyterlab_widgets-3.0.11-py3-none-any.whl (214 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 214.4/214.4 kB 9.1 MB/s eta 0:00:00
Using cached pexpect-4.9.0-py2.py3-none-any.whl (63 kB)
Downloading platformdirs-4.2.2-py3-none-any.whl (18 kB)
Downloading prompt_toolkit-3.0.47-py3-none-any.whl (386 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 386.4/386.4 kB 13.7 MB/s eta 0:00:00
Downloading ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl (148 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 148.9/148.9 kB 7.6 MB/s eta 0:00:00
Downloading widgetsnbextension-4.0.11-py3-none-any.whl (2.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 26.3 MB/s eta 0:00:00
Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB)
Using cached stack_data-0.6.3-py3-none-any.whl (24 kB)
Using cached asttokens-2.4.1-py2.py3-none-any.whl (27 kB)
Using cached executing-2.0.1-py2.py3-none-any.whl (24 kB)
Downloading parso-0.8.4-py2.py3-none-any.whl (103 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.7/103.7 kB 4.2 MB/s eta 0:00:00
Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB)
Using cached smmap-5.0.1-py3-none-any.whl (24 kB)
Using cached pure_eval-0.2.2-py3-none-any.whl (11 kB)
Using cached wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
Installing collected packages: wcwidth, rectpack, pypng, pure-eval, ptyprocess, klayout, antlr4-python3-runtime, aenum, widgetsnbextension, typing-extensions, types-PyYAML, trimesh, traitlets, tornado, toolz, tomli, tifffile, smmap, shellingham, shapely, ruamel.yaml.clib, pyzmq, python-dotenv, psutil, prompt-toolkit, platformdirs, pexpect, parso, orjson, omegaconf, networkx, nest-asyncio, MarkupSafe, mapbox_earcut, loguru, lazy-loader, jupyterlab-widgets, imageio, freetype-py, executing, decorator, debugpy, click, cachetools, asttokens, appnope, annotated-types, stack-data, scikit-image, ruamel.yaml, qrcode, pydantic-core, matplotlib-inline, jupyter-core, jinja2, jedi, gitdb, comm, typer, pydantic, jupyter-client, ipython, gitpython, pydantic-settings, pydantic-extra-types, ipywidgets, ipykernel, kfactory, ipytree, ipyevents, gdsfactory
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/lukasc/.klayout/python/SiEPIC/install.py", line 41, in install
    importlib.import_module(package)
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'gdsfactory'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/py_compile.py", line 144, in compile
    code = loader.source_to_code(source_bytes, dfile or file,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/lukasc/Library/Python/3.11/lib/python/site-packages/aenum/_py2.py", line 5
    raise exc, None, tb
             ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/compileall.py", line 240, in compile_file
    ok = py_compile.compile(fullname, cfile, dfile, True,
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/py_compile.py", line 150, in compile
    raise py_exc
py_compile.PyCompileError:   File "/Users/lukasc/Library/Python/3.11/lib/python/site-packages/aenum/_py2.py", line 5
    raise exc, None, tb
             ^
SyntaxError: invalid syntax


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
    return func(self, options, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 452, in run
    installed = install_given_reqs(
                ^^^^^^^^^^^^^^^^^^^
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/req/__init__.py", line 72, in install_given_reqs
    requirement.install(
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/req/req_install.py", line 856, in install
    install_wheel(
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/operations/install/wheel.py", line 725, in install_wheel
    _install_wheel(
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/operations/install/wheel.py", line 611, in _install_wheel
    success = compileall.compile_file(path, force=True, quiet=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/compileall.py", line 257, in compile_file
    encoding = sys.stdout.encoding or sys.getdefaultencoding()
               ^^^^^^^^^^^^^^^^^^^
  File "/Applications/KLayout HW-klayout-0.29.1-macOS-Monterey-1-qt5MP-RsysPhb311.app/Contents/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_internal/utils/misc.py", line 399, in encoding
    return self.orig_stream.encoding
           ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: '__PYA_Channel' object has no attribute 'encoding'
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
ERROR: Could not find a version that satisfies the requirement pygdsfactory (from versions: none)
ERROR: No matching distribution found for pygdsfactory
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /Users/lukasc/Library/Python/3.11/lib/python/site-packages/numpy-1.26.2.dist-info due to invalid metadata entry 'name'
False
> import gdsfactory
ModuleNotFoundError: No module named 'gdsfactory'
  

To Reproduce

See above.

image

Expected behavior

that it installs and imports correctly

Suggested fix

Making the import work.

@lukasc-ubc lukasc-ubc added the bug Something isn't working label Jun 22, 2024
@joamatab
Copy link
Contributor

I've never tried installing it in the macro development from klayout,

we usually recommend using klayout as a viewer and installing gdsfactory on a separate python

@lukasc-ubc
Copy link
Contributor Author

Here is a second attempt that works:

> import pip
> pip.main(['install','gdsfactory'])
> import gdsfactory

And it ran successfully. I was able to get the a layout example to run and save a layout.

Now, on to trying to display that layout directly, without saving and loading. Any ideas how @joamatab ?

@mustafacc could you please check if this works on Linux?

@seanlam97 could you please check if this works on Windows?

thank you

@mustafacc
Copy link

on ubuntu 22.04 it's failing

> pip.main(['install', 'gdsfactory'])
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting gdsfactory
  Using cached gdsfactory-8.2.3-py3-none-any.whl (636 kB)
Collecting loguru<1
  Using cached loguru-0.7.2-py3-none-any.whl (62 kB)
Collecting trimesh<4.4,>=4
  Using cached trimesh-4.3.2-py3-none-any.whl (693 kB)
Requirement already satisfied: numpy<2 in /home/mustafa/.local/lib/python3.10/site-packages (from gdsfactory) (1.26.3)
Collecting rectpack<1
  Using cached rectpack-0.2.2.tar.gz (17 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      Info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
      ERROR: Unknown option: --egg-base
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output. 

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
1

It seems the issue is with installing the package rectpack itself.

@lukasc-ubc
Copy link
Contributor Author

Could you try installing with the "--no-dependencies" option added?

> import pip
> pip.main(['install','--no-dependencies','gdsfactory'])
> import gdsfactory

Maybe this can skip the installation of rectpack, and we can see if it is necessary.

@sebastian-goeldi
Copy link
Collaborator

sebastian-goeldi commented Jun 23, 2024

I would highly suggest to move away from installing directly in klayout. It can completely brick systems if used carelessly on linux, on MacOS it can brick your (ana)conda env (since it most likely uses the default brew env).

Debian (and most likely other linux distros) is moving towards disallowing people to just install system wide (or even user space) packages with no venv. Therefore, you'd need to at least set KLAYOUT_PYTHONHOME and similar. PEP for reference.

This is to safeguard users from accidentially bricking vital system packages like this https://forums.linuxmint.com/viewtopic.php?t=381919
https://forums.centos.org/viewtopic.php?t=74134

Sure, there are ways to re-enable the old behavior, but that would feel like teaching kids to play on the train tracks in front of the house because it's easily viewable from the balcony.

@mustafacc
Copy link

@lukasc-ubc It installs okay without dependencies, however, import fails when attempting to load kfactory (another package thats failing to install).

@sebastian-goeldi Agreed. I ran this on a VM to not cause any issues with the system's python. I was investigating https://github.com/flaport/condalayout to potentially mitigate this issue on linux but I ran into other issues.

@sebastian-goeldi
Copy link
Collaborator

sebastian-goeldi commented Jun 24, 2024

Btw it works (on linux, but macos should be the same, just different python) with the following which will not abuse/pollute the system/user env (this is debian so maybe python3 needs to be replaced with python depending on what the flavor of linux of the day it is):

cd ~
mkdir kfactory_klayout && cd kfactory_klayout
python3 -m venv .env
source .env/bin/activate
python -m pip install kfactory
KLAYOUT_PYTHONPATH=~/kfactory_klayout/.env/lib/python3.11/site-packages/ klayout

with this I was able to successfully import and after a quick test use kfactory.

But be advised, at least with the debug console open, it takes a good 10 seconds to import kfactory (not even talking about gdsfactory here).

For windows I don't really know, nor do I really have it lying around. My best bet would be WSL2

Also this installation path is a bit asinine as it's installing the pure python klayout within klayout (but this could be mitigated with a different package)

@mustafacc
Copy link

mustafacc commented Jul 5, 2024

I tried it but I seem to be running into an issue importing encodings module, even though it can be imported within that env.

(.env) (base) mustafa@mustafa:~/kfactory_klayout$ klayout 
Info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/proc/61953/exe'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/proc/61953/exe'
  sys.base_prefix = ''
  sys.base_exec_prefix = ''
  sys.platlibdir = 'lib'
  sys.executable = '/proc/61953/exe'
  sys.prefix = ''
  sys.exec_prefix = ''
  sys.path = [
    '/home/mustafa/kfactory_klayout/.env/lib/python3.12/site-packages/',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007d6d244c3840 (most recent call first):
  <no Python frame>

echo $KLAYOUT_PYTHONPATH: /home/mustafa/kfactory_klayout/.env/lib/python3.12/site-packages/
which python: /home/mustafa/kfactory_klayout/.env/bin/python
python --version: Python 3.12.2

@sebastian-goeldi
Copy link
Collaborator

You need to use system python on linux. Or to be more accurate, the python klayout was compiled against. And that, unless you compiled it yourself is probably not 3.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants