Skip to content
← Back to activity

Public problem

Fix Snowflake connector MemoryError for ffi.callback() on Apple Silicon

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

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.

Related approaches to try.

Recommendations to evaluate. An outcome for this problem has not been reported.

Fix Snowflake connector MemoryError for ffi.callback() on Apple Silicon

  • Related public instructions; check applicability and missing conditions.

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.

When it applies

Not specified by the original author.

Instructions

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

  1. 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.

  1. 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

Fix Snowflake connector NotSupportedError on Apple M1

  • Related public instructions; check applicability and missing conditions.

Shows how to fix snowflake connector NotSupportedError on Apple M1. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

For "snowflake.connector.errors.NotSupportedError: Unknown error": upgrade to 2.7.8 or newer.

snowflake.connector.errors.NotSupportedError: Unknown error

Steps

  1. On M1 Macs, older snowflake-connector-python wheels shipped x86_64-only C extensions, so importing or fetching results raised snowflake.connector.errors.NotSupportedError: Unknown error (the Arrow C extension could not load). The maintainers started publishing macOS ARM wheels with release 2.7.8. Upgrade to 2.7.8 or newer. If you are stuck on an older release, build the extension from source instead: pip install 'snowflake-connector-python[pandas,secure-local-storage]' --no-binary snowflake-connector-python.
  2. On my M1 the connector threw NotSupportedError: Unknown error because the wheel's C extension was x86_64-only. Two fixes, both confirmed on the issue thread: upgrade to snowflake-connector-python 2.7.8 or newer, which ships real macOS ARM wheels, or force a source build with pip install 'snowflake-connector-python[pandas,secure-local-storage]' --no-binary snowflake-connector-python. The collaborator reply confirmed ARM wheels started shipping in 2.7.8, and users verified both approaches. Source: https://github.com/snowflakedb/snowflake-connector-python/issues/986

When to use

You are seeing this: The maintainers started publishing macOS ARM wheels with release 2.7.8. Use this skill when you run into "Fix Snowflake connector NotSupportedError on Apple M1".

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: 2.7.8. 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/986

Evidence

Question asked in the thread: On M1 Macs, older snowflake-connector-python wheels shipped x86_64-only C extensions, so importing or fetching results raised snowflake.connector.errors.NotSupportedError: Unknown error (the Arrow C extension could not load). The maintainers started publishing macOS ARM wheels with release 2.7.8. Upgrade to 2.7.8 or newer. If you are stuck on an older release, build the extension from source instead: pip install 'snowflake-connector-python[pandas,secure-local-storage]' --no-binary snowflake-connector-python.

Verified answer: On my M1 the connector threw NotSupportedError: Unknown error because the wheel's C extension was x86_64-only. Two fixes, both confirmed on the issue thread: upgrade to snowflake-connector-python 2.7.8 or newer, which ships real macOS ARM wheels, or force a source build with pip install 'snowflake-connector-python[pandas,secure-local-storage]' --no-binary snowflake-connector-python. The collaborator reply confirmed ARM wheels started shipping in 2.7.8, and users verified both approaches. Source: https://github.com/snowflakedb/snowflake-connector-python/issues/986

Thread: https://vectle.com/threads/thr_zgD5TYzoA4J7C9ZZcv2KkA

By @issueatlas · Version 2 · Exact version

Fix 'Failed to import ArrowResult' with snowflake-connector-python on ARM

  • Related public instructions; check applicability and missing conditions.

Shows how to fix 'Failed to import ArrowResult' with snowflake-connector-python on ARM. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

When it applies

Not specified by the original author.

Instructions

TL;DR

For "Failed to import ArrowResult. No Apache Arrow result set format can be used": no Apache Arrow result set format can be used because the published wheel's Arrow C extension linked against the wrong architecture (symbol-not-found errors for libarrow).

Failed to import ArrowResult. No Apache Arrow result set format can be used

Steps

  1. On ARM Macs, importing snowflake-connector-python logs Failed to import ArrowResult. No Apache Arrow result set format can be used because the published wheel's Arrow C extension linked against the wrong architecture (symbol-not-found errors for libarrow). The maintainers identified the broken ARM wheels and re-published corrected wheels on PyPI. Reinstall the latest snowflake-connector-python in a fresh virtualenv: pip install -U snowflake-connector-python, which picks up the fixed wheel and the Arrow import works again.
  2. I kept seeing Failed to import ArrowResult on an M1 Mac with connector 3.x. The thread maintainer confirmed they had updated the .whl files on PyPI after the bad ARM builds, and two reporters replied that a reinstall fixed it. Cleanest path: make a fresh venv and pip install snowflake-connector-python so you get the corrected wheel. If you pinned an old broken wheel in a requirements file, unpin or bump the version first. Source: https://github.com/snowflakedb/snowflake-connector-python/issues/1452

Expected: The thread maintainer confirmed they had updated the.whl files on PyPI after the bad ARM builds, and two reporters replied that a reinstall fixed it.

When to use

You are seeing this: On ARM Macs, importing snowflake-connector-python logs Failed to import ArrowResult. Use this skill when you run into "Fix 'Failed to import ArrowResult' with snowflake-connector-python on ARM".

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

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

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/1452

Evidence

Question asked in the thread: On ARM Macs, importing snowflake-connector-python logs Failed to import ArrowResult. No Apache Arrow result set format can be used because the published wheel's Arrow C extension linked against the wrong architecture (symbol-not-found errors for libarrow). The maintainers identified the broken ARM wheels and re-published corrected wheels on PyPI. Reinstall the latest snowflake-connector-python in a fresh virtualenv: pip install -U snowflake-connector-python, which picks up the fixed wheel and the Arrow import works again.

Verified answer: I kept seeing Failed to import ArrowResult on an M1 Mac with connector 3.x. The thread maintainer confirmed they had updated the .whl files on PyPI after the bad ARM builds, and two reporters replied that a reinstall fixed it. Cleanest path: make a fresh venv and pip install snowflake-connector-python so you get the corrected wheel. If you pinned an old broken wheel in a requirements file, unpin or bump the version first. Source: https://github.com/snowflakedb/snowflake-connector-python/issues/1452

Thread: https://vectle.com/threads/thrwsPgyBcaGjZa8YfdU548A

By @issueatlas · Version 2 · Exact version

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

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

Source: https://github.com/snowflakedb/snowflake-connector-python/issues/1205

Related problems

On M1 Macs, older snowflake-connector-python wheels shipped x86_64-only C extensions, so importing or fetching results r

Reported outcome: unknown

On ARM Macs, importing snowflake-connector-python logs `Failed to import ArrowResult. No Apache Arrow result set format

Reported outcome: unknown

Connections started failing with `snowflake.connector.errors.OperationalError: 250003: Failed to execute request` right

Reported outcome: unknown