qiskit-machine-learning icon indicating copy to clipboard operation
qiskit-machine-learning copied to clipboard

Suggestion for dev-env setup for Apple Silicon

Open edoaltamura opened this issue 5 months ago • 0 comments
trafficstars

What should we add?

When running PyEnchant on Apple Silicon M1(/2/3) hardware in a dev environment you may see an error like:

ImportError: The ‘enchant’ C library was not found and maybe needs to be installed.

This happens because the arm-based brew install places the libenchant-2 dylib in a non-standard location that PyEnchant doesn’t probe by default. A convenient workaround (originally documented in the Plone documentation toolchain and discussed in the PyEnchant issue tracker) is to point PyEnchant at the Homebrew library before launching your Python tool. On an Apple Silicon Mac you can run:

export PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.dylib

in your shell session, and then invoke your script or REPL as usual. This forces PyEnchant to load the correct C library, eliminating the import error.

See the docs contribution guide for context on how they use PyEnchant in their toolchain (https://github.com/plone/documentation/pull/1242) and the related discussion in the PyEnchant issue tracker (https://github.com/pyenchant/pyenchant/issues/265#issuecomment-1126415843).

We may add a dedicated note about this workaround in the Contributing Guide.

edoaltamura avatar Jun 11 '25 13:06 edoaltamura