2

I recently purchased new Mac Pro w/ Mac Os X 11.0.1 & Apple Silicon M1.

I installed homebrew (when enabling Rosetta) and managed to install python3.9 and other packages through brew (numpy==1.19.5 & scipy==1.6.0, amongst others).

However, executing my one-liner script yields a "bus error". That happens when I try to import curve_fit from scipy.optimize. Any ideas how to solve that? or I'll have to wait for the optimized package of scipy?

I believe this is hardware related and is due to non optimal compilation of scipy for the M1 architecture (data are lost somewhere on the memory bus? https://www.quora.com/Why-there-is-a-bus-error-in-the-Python-program-when-it-recurs-over-18-713-times ).

Python code:

from scipy.optimize import curve_fit

Error:

zsh: bus error

Tail lines when running this code in python3.9 with -v option.

import 'scipy.sparse.linalg.dsolve' # <_frozen_importlib_external.SourceFileLoader object at 0x1182ad040>
# /opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/__pycache__/__init__.cpython-39.pyc matches /opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/__init__.py
# code object from '/opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/__pycache__/__init__.cpython-39.pyc'
# /opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/arpack/__pycache__/__init__.cpython-39.pyc matches /opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/arpack/__init__.py
# code object from '/opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/arpack/__pycache__/__init__.cpython-39.pyc'
# /opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/arpack/__pycache__/arpack.cpython-39.pyc matches /opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py
# code object from '/opt/homebrew/lib/python3.9/site-packages/scipy/sparse/linalg/eigen/arpack/__pycache__/arpack.cpython-39.pyc'
zsh: bus error  python3.9 -v debug.py
Mietek
  • 21
  • 2

0 Answers0