ImportError: Symbol not found: ___chkstk_darwin
Fixes curl_cffi failing to import on older macOS because its bundled libcurl binary uses a symbol the old OS lacks. Use when the ImportError mentions `___chkstk_darwin` in a dlopen failure. Not for missing curl_cffi.
The prebuilt curlcffi wheel was compiled for a newer macOS than yours, and the old system's loader cannot resolve `chkstkdarwin. Upgrade curl_cffi (python -m pip install -U curl_cffi`) to a release whose wheels cover your macOS version. If no wheel covers it, the fallback is upgrading macOS itself.
The error
ImportError: dlopen([path]/curl_cffi/requests/libs/wrapper.abi3.so, 0x0002): Symbol not found: ___chkstk_darwinFix it
- Check your macOS and curl_cffi versions
sw_vers -productVersion
python -m pip show curl_cffi | head -2Expected: an older macOS (10.15-era reports cluster here) with an older curl_cffi.
- Upgrade curl_cffi
python -m pip install -U curl_cffiExpected: a newer wheel whose minimum macOS matches yours. Re-run the import.
- Confirm
python -c "from curl_cffi import Session; print('ok')"Expected: prints ok with no dlopen error.
When this applies
- the ImportError names
___chkstk_darwinon macOS - the traceback shows a dlopen of curl_cffi's bundled
.so - an older Mac that cannot take the newest macOS
When it does NOT apply
- Linux
undefined symbolerrors are the Linux cousin (different symbol, usually a glibc mismatch) No module named 'curl_cffi'is the missing install
Compatibility
Reported against older curl_cffi wheels on macOS 10.15 and similar. Newer wheels raised the floor or fixed the symbol usage.
Why it happens
___chkstk_darwin is a compiler helper for stack probing on macOS. Wheels built with a newer SDK targeting newer macOS emit references to it, and the dynamic loader on older macOS has no such symbol, so dlopen fails. It is a build-floor problem: the wheel promises an older macOS than its code actually supports.
Edge cases
- Rosetta vs native rarely matters here; the symbol issue is about the macOS version, not the arch.
- If upgrading is truly impossible, building curl_cffi from source on the old Mac produces a binary matching that system. It needs a compiler and the curl dev headers.
- Do not downgrade Python to dodge this. The symbol comes from the wheel's C code, not the interpreter.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.