AntonKueltz / fastecdsa

Python library for fast elliptic curve crypto
https://pypi.python.org/pypi/fastecdsa
The Unlicense
270 stars 78 forks source link

MacOS Monerray Apple Silicon Python 3.9 issue with install/import #76

Closed andrepn closed 2 years ago

andrepn commented 3 years ago

Hi I"m having a problem with fastecdsa.

Initially when I tried to install I had an issue with include gmp.h but fixed that with this command:

CFLAGS=-Ibrew --prefix gmp/include LDFLAGS=-Lbrew --prefix gmp/lib pip install fastecdsa

Now when I try

python -c "from fastecdsa import curvemath", I get the following error:

Traceback (most recent call last): File "", line 1, in ImportError: dlopen(/Users/andrewnoel/.local/share/virtualenvs/cairo/lib/python3.9/site-packages/fastecdsa/curvemath.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '___gmpz_add'

I'm really not sure how to fix this. Any help is appreciated.

andrepn commented 3 years ago

Seems to be some issue with 3.9 trying to run cairo. I switched to python3.7 in virtual environment for a temp fix

justinba1010 commented 3 years ago

Hi @andrepn,

I'm running fastecdsa on the Apple M1. The fix I have is:

brew uninstall gmp
arch -arm64 brew install gmp
python3 -m pip install --no-binary :all: --no-use-pep517 fastecdsa

I would even alias pip install and brew install to those to avoid this issue for a LOT of packages(I ran into this when I first got the M1).

andrepn commented 3 years ago

Hi @andrepn,

I'm running fastecdsa on the Apple M1. The fix I have is:

brew uninstall gmp
arch -arm64 brew install gmp
python3 -m pip install --no-binary :all: --no-use-pep517 fastecdsa

I would even alias pip install and brew install to those to avoid this issue for a LOT of packages(I ran into this when I first got the M1).

Thank you, that's very helpful! It is crazy how changes at the chip level create unpredictable behavior layers above