coincurve: Import fails on macOS 12 arm64 with Python 3.10
For some reason python claims it can’t find the function _secp256k1_nonce_function_default in the coincurve/_libsecp256k1.cpython-310-darwin.so library… However a dump from nm shows that it’s available.
Error from python:
Python 3.10.1 (main, Dec 6 2021, 22:18:13) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import coincurve
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/robd/code/lbry-sdk/env/lib/python3.10/site-packages/coincurve-16.0.0-py3.10-macosx-12-arm64.egg/coincurve/__init__.py", line 1, in <module>
from coincurve.context import GLOBAL_CONTEXT, Context
File "/Users/robd/code/lbry-sdk/env/lib/python3.10/site-packages/coincurve-16.0.0-py3.10-macosx-12-arm64.egg/coincurve/context.py", line 4, in <module>
from coincurve.flags import CONTEXT_ALL, CONTEXT_FLAGS
File "/Users/robd/code/lbry-sdk/env/lib/python3.10/site-packages/coincurve-16.0.0-py3.10-macosx-12-arm64.egg/coincurve/flags.py", line 1, in <module>
from ._libsecp256k1 import lib
ImportError: dlopen(/Users/robd/code/lbry-sdk/env/lib/python3.10/site-packages/coincurve-16.0.0-py3.10-macosx-12-arm64.egg/coincurve/_libsecp256k1.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_secp256k1_nonce_function_default'
nm dump of coincurve/_libsecp256k1.cpython-310-darwin.so:
U _PyArg_UnpackTuple
U _PyErr_Occurred
U _PyEval_RestoreThread
U _PyEval_SaveThread
U _PyImport_ImportModule
0000000000001998 T _PyInit__libsecp256k1
U _PyLong_FromLong
U _PyLong_FromVoidPtr
U _PyObject_CallMethod
U _PyObject_Free
U _PyObject_Malloc
U __Py_Dealloc
U __Py_NoneStruct
U ___chkstk_darwin
U ___stack_chk_fail
U ___stack_chk_guard
U _bzero
U _secp256k1_context_clone
U _secp256k1_context_create
U _secp256k1_context_destroy
U _secp256k1_context_randomize
U _secp256k1_context_set_error_callback
U _secp256k1_context_set_illegal_callback
U _secp256k1_ec_privkey_tweak_add
U _secp256k1_ec_privkey_tweak_mul
U _secp256k1_ec_pubkey_combine
U _secp256k1_ec_pubkey_create
U _secp256k1_ec_pubkey_parse
U _secp256k1_ec_pubkey_serialize
U _secp256k1_ec_pubkey_tweak_add
U _secp256k1_ec_pubkey_tweak_mul
U _secp256k1_ec_seckey_verify
U _secp256k1_ecdh
U _secp256k1_ecdsa_recover
U _secp256k1_ecdsa_recoverable_signature_convert
U _secp256k1_ecdsa_recoverable_signature_parse_compact
U _secp256k1_ecdsa_recoverable_signature_serialize_compact
U _secp256k1_ecdsa_sign
U _secp256k1_ecdsa_sign_recoverable
U _secp256k1_ecdsa_signature_normalize
U _secp256k1_ecdsa_signature_parse_compact
U _secp256k1_ecdsa_signature_parse_der
U _secp256k1_ecdsa_signature_serialize_compact
U _secp256k1_ecdsa_signature_serialize_der
U _secp256k1_ecdsa_verify
U _secp256k1_nonce_function_default
U _secp256k1_nonce_function_rfc6979
U dyld_stub_binder
If anyone could help me figure out why python can’t find a function that’s plainly available (3rd from the bottom of the list right above) I’d love to know how to fix this.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 17 (5 by maintainers)
Fixed! https://pypi.org/project/coincurve/17.0.0/
Thanks @ofek you rock!
I had to use a much older version of python (I think I went with python 3.7) and an older version of coincurve. I think I used coincurve 13 with
pip install coincurve==13.0.0. The older versions of coincurve don’t uselibsecp256k1which seems to not work on M1 macs.