jaxlib AVX instructions error in Conda on Apple Silicon
petermchale opened this issue · comments
Description
How to Reproduce
On an Apple M1 Pro, create a new conda environment, install pysyft using pip install -U syft[data_science]
, and then attempt to start a server and a client using the directions in the README. You'll get a runtime error:
RuntimeError: This version of jaxlib was built using AVX instructions, which your CPU and/or operating system do not support. You may be able work around this issue by building jaxlib from source.
Expected Behavior
I expect not to get this error on a machine that is likely quite popular among data scientists.
Screenshots
System Information
- OS: macOS
- OS Version: 14.4.1 (Sonoma)
- Language Version: Python 3.12.2
- Package Manager Version: conda 22.9.0, pip 23.3.1
- Browser (if applicable): n/a
- Browser Version (if applicable): n/a
Additional Context
Add any other context about the problem here.
Hi @petermchale we use Apple Silicon daily. If I have to guess its because your version of conda might actually be for x86
not for apple silicon.
This is a common problem.
You can verify by checking with:
>>> import platform
>>> platform.platform()
'macOS-13.5.2-arm64-arm-64bit'
It should say arm
but it might say x86
.
The problem with running python in rosetta emulation mode is that it uses the jaxlib
x86 libraries which are compiled with AVX
instructions and rosetta is unable to emulate those special cpu instructions.
Either uninstall and re-install it with the arm64
version, or use something like pyenv
to install a different native global python3 version and then use that to install syft.
I've uninstalled my current conda, and will try re-installing the arm64 conda tomorrow.
@petermchale Yes, you are running python in x86
emulation mode. You need to install an Apple Silicon native arm64
version of python.
Unfortunately I can't give you a link as it looks like all of anacondas package downloads are behind a login now.
pip install -U syft[data_science]
is now much faster than it was in x86 emulation mode.
Thanks for the prompt help in getting this set up.
May I suggest updating the README to indicate that users should make sure to use the arm64 version of conda, not the x86 version? @madhavajay