-
Notifications
You must be signed in to change notification settings - Fork 50
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
go get for go-python3 on mac M1 is not working. #7
Comments
as far as I can see you're trying to use a darwin_amd64 (Intel) Python with a darwin_arm64 (M1) Go. (Unfortunately there are no official Python 3.7 darwin_arm64 builds, so that's no surprise). A quick fix is to use a darwin_amd64 (Intel) variant of Golang ( We've also discussed this problem here: (JFWIW: There's work going on to support more recent Python versions with |
Using a darwin_amd64 (Intel) variant of Golang is not possible, because in that case debugging the code on my Mac (m1) is not possible. |
what exactly isn't working? |
I can't run my code in debug mode. As a developer, I need it |
Do you have an example? (I imagine you're trying to use GDB or Delve and you get an error?). Just trying to understand. |
Sure, I need to re-install Go and Python3 and will attach a screenshot |
|
Hi Christian, Thank you |
Yeah the amd64 option is a non starter , it really does need to be arm. |
Just so folks know. 3.7.16 DOES compile on a mac M1. Earliier ones dont I think. You'll have to compile it yourself and you MIGHT have troubles with ctypes and ffi. Still havent figured out yet how to tell go-python which install of python to use as pkg-config points to the wrong python, and I cant find any flags to pass go to tell it to use an alternative one. |
Ok. Got it working. Heres the deal.
It MIGHT complain about ffi. and throw errors. Thats a tough one. In the python 3.7 and earlier lines python included a vendored version of libffi that seems to explode in flames on the macm1. I havent really solved this one yet. Theres a --use-system-ffi option for config, but it kind of doesnt work. There are some patches for later versions of pythons build scripts that could be backported but I havent quite got these to work yet. You CAN still install this python , but ctypes will be broken which might break some of the math packages. Work in process. Now Make type "which pkg-config" to find out where your pkg-config app is installed. If its in a homebrew opt, it likely will point to the wrong version of python. You'll wanna get the python3.pc and python3.7.pc files from /usr/local/lib/pkgconfig and copy these into the homebrew equivelent lib/pkgconfig You'll know its working when;- THEN you can compile and run it. This still isn't ideal, without ctypes and ffi, a lot of pythons signature math/science packages are unlikely to work. So at this stage the game is still about getting python3 to work with FFI and thus CTYPES. Or better still to actually support a modern version of python3 as 3.7 is solidly deprecated. edit: Apparently this works with 3.8 with a slight modification to the library to remove a deprecated function. |
I am having a new Mac with an M1 processor installed.
I installed a Golang version with an arm version for Mac M1 from the official site: https://go.dev/dl/
I downloaded Python3 for M1.
After that, I tried to run: go get github.com/DataDog/go-python3
and got an error message attached to the file.
I tried also to run: go get github.com/go-python/cpy3
and I got the same error.
Untitled.txt
On the other hand, I downloaded and installed the Golang for the x86 processor, it works fine.
but, I have to work with the right version on my Mac (Golang version for M1, arm version).
The text was updated successfully, but these errors were encountered: