-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Error importing gdstk >= 0.9.38 on Mac M2 #199
Comments
one workwaround is to with pip on m1/m2 there are issues, it would be great to fix this |
I faced the same issue... |
@tylerflex were you able to find a solution to this issue? I am facing the same problem on my Mac M1. |
How about using?
that will work except for the latest gdstk version, which we haven't been able to release in conda |
The 'conda install gdstk' method worked for me! |
Would be great to fix this issue, I use homebrew and not conda to manage all my Python development environments and don't want to switch just for this. I'm having the same issue on my M2 MacBook Pro running Ventura 13.6. This is an ARM-architecture specific problem. I have both the ARM and Intel versions of homebrew (and Python) installed, and the wheel for the Intel versions, which run through Rosetta, work fine. But the ARM version produces the following error:
|
After running 'conda install gdstk' I do not get the dlopen ImportError when importing gdstk in my systems current version of python (3.11.6), however I am still getting the error in python 3.9. I am trying to resolve this error specifically for python3.9 because I want to import gdsfactory into klayout (on M1 Mac), which uses python 3.9, and I am getting this same ImportError when trying to import gdsfactory in klayout or python3.9 through the terminal. I have created a new conda environment that uses python 3.9 and conda installed gdstk + pip installed gdsfactory, and am able to import gdsfactory successfully here and write gdsfactory code. However, once I exit out of this virtual env, I am still unable to import gdsfactory in python3.9 through the terminal or klayout. Does anyone have suggestions on how I could resolve this? Thanks! Update: klayout's python3.9 (and my system python 3.9) are managed by Homebrew, whereas my systems python3.11 is managed by conda, so that's why these conda updates aren't applying to them. |
any updates on this? |
I found this the other day: https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/ but I'm not sure if it would help or if it's something that's already taken care of (it's from 2015). In any case, without an m2, I can't do much debugging. If anyone with a m2 is willing to spend some hours figuring this out, please do. |
Can someone with a MAC test this? :) |
Maybe this helps in some way, so apparently Github Actions now have beta M1 public runners. Potentially we can set up a test to reproduce this issue that mirrors the conda recipe one but changing the build configuration with Lucas's suggestion potentially modifying the testing Github action should trigger this to verify if any patch works. We wouldn't have to pin gdstk for tidy3d in that case? |
I might be able to give this a try tomorrow using the github M1 runners. I'll post any updates here! |
I am not sure what to test here. I currently have a working (at least I think so) gdstk installed via anaconda from conda-forge's channel. I'm on MacOS 14.1 with M2 chip. (I don't have Rosetta yet. Powering through.)
@tylerflex I think your error means that the gdstk .so file is not finding a dynamic library. To help with debug, here's the dynamic libraries loaded by gdstk on my system. Would be nice to check if you have the same versions (and if they are installed). Mine were all managed by conda That's where I would start looking:
I'm also hijacking this comment to see if anyone is interested in developing a klayout.app homebrew formula with me (essentially the LW version from Kazzz). I'm running a setup like this now and it works fine without rosetta. |
Hi Thomas, yes, using conda it works, some companies are forbidden to use conda and they would need to |
I see. In that case I usually recommend compiling from source.
…On Thu, Dec 7, 2023 at 15:15 Joaquin Matres ***@***.***> wrote:
Hi Thomas,
yes, using conda it works,
some companies are forbidden to use conda and they would need to pip
install gdstk with the brew python from Mac
—
Reply to this email directly, view it on GitHub
<#199 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIJZEZBC7UW7J45ZPCTAA3YIIPUTAVCNFSM6AAAAAA5LFQFZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBWGA2DIMRXGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've added a fix and enabled arm64 wheel builds in release v0.9.48. |
Thanks @heitzmann !
which I think was the original error I was getting |
Thanks @tylerflex! I'm thinking that the issue is still the cross-compilation (we're using the intel MacOS runners to compile the arm64 architecture). The python interface might be working correctly now, but the internal library might still have issues. I have to figure out how to instruct the build system to also cross-compile |
Another release (0.9.49) is live on pypi with a possible fix for Apple Silicon. Now it uses a universal wheel that is supposed to include both architectures. Please make sure you're using pip >= 20.3, which added support for the universal wheels before pip installing. |
Install works on my M2 Apple Silicon machine! 🎉 I think this issue can be closed now. |
Might I make a suggestion? Feel free to use FlyCI's M1 and M2 runners. Our runners are on average 2x faster and 2x cheaper than GitHub's AND we have a free tier for OSS projects (see below). Install InstructrionsEasily replace your M1 runners: jobs:
ci:
- runs-on: macos-latest
+ runs-on: flyci-macos-large-latest-m1
steps:
- name: 👀 Checkout repo
uses: actions/checkout@v4 500 mins/month Free for Public ReposSInce your repo is public, then FlyCI offers 500 mins/month of free M1 runner usage with the Best Regards, |
between 0.9.37 and 0.9.38, I am not able to import gdstk properly on my Mac M2.
Must be an issue with something in here
v0.9.37...v0.9.38
I tried re-installing cmake and zlib with brew, no luck.
Note: running MacOS 12.5.1 Monterey
The text was updated successfully, but these errors were encountered: