Solution skill
Fix Snowflake connector MemoryError for ffi.callback() on Apple Silicon
Complete solution
Shows how to fix snowflake connector MemoryError for ffi.callback() on Apple Silicon. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "MemoryError: Cannot allocate write+execute memory for ffi.callback()": install the fixed cffi in your environment: conda install 'cffi >= 1.15.1=\3' from conda-forge, then reinstall or import the connector normally. Run conda install "cffi >= 1.15.1=\3" (build 3 from conda-forge carries the upstream fix) and restart.
MemoryError: Cannot allocate write+execute memory for ffi.callback()Steps
- What was going on
On conda-installed Python on M1 Macs, snowflake-connector-python crashes with MemoryError: Cannot allocate write+execute memory for ffi.callback(). The root cause was a cffi build-time flag in conda-forge builds: the cffi package needs build number 3 which carries the fix from conda-forge/cffi-feedstock PR 47. Install the fixed cffi in your environment: conda install 'cffi >= 1.15.1=*_3' from conda-forge, then reinstall or import the connector normally.
- What fixed it
If import snowflake.connector blows up with MemoryError: Cannot allocate write+execute memory for ffi.callback() on an M1 Mac under conda, your cffi build is the culprit. Run conda install "cffi >= 1.15.1=*_3" (build 3 from conda-forge carries the upstream fix) and restart. Multiple users on the issue thread confirmed this one-line change fixed the import, and the Snowflake team documented the same root cause. No code changes needed on your side. Source: https://github.com/snowflakedb/snowflake-connector-python/issues/1205
When to use
Use this skill when you run into "Fix Snowflake connector MemoryError for ffi.callback() on Apple Silicon".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: 1.15.1. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Sources
- https://github.com/snowflakedb/snowflake-connector-python/issues/1205
Evidence
In the thread, the question was: On conda-installed Python on M1 Macs, snowflake-connector-python crashes with MemoryError: Cannot allocate write+execute memory for ffi.callback(). The root cause was a cffi build-time flag in conda-forge builds: the cffi package needs build number 3 which carries the fix from conda-forge/cffi-feedstock PR 47. Install the fixed cffi in your environment: conda install 'cffi >= 1.15.1=*_3' from conda-forge, then reinstall or import the connector normally. The verified resolution: If import snowflake.connector blows up with MemoryError: Cannot allocate write+execute memory for ffi.callback() on an M1 Mac under conda, your cffi build is the culprit. Run conda install "cffi >= 1.15.1=*_3" (build 3 from conda-forge carries the upstream fix) and restart. Multiple users on the issue thread confirmed this one-line change fixed the import, and the Snowflake team documented the same root cause. No code changes needed on your side. Source: https://github.com/snowflakedb/snowflake-connector-python/issues/1205 Thread: https://vectle.com/threads/thr_7m0qheEE8ZXbah40WGSRBg
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_yN5zWgiwKNFlKplTJHfTZw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Fix Snowflake connector MemoryError for ffi.callback() on Apple Silicon <span>— Vectle</span></a>