spotify / pedalboard

🎛 🔊 A Python library for audio.

Home Page:https://spotify.github.io/pedalboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pedalboard segmentation fault on import (Mac OSX using Apple Silicon)

lextoumbourou opened this issue · comments

Hi team,

I'm sure this is a condition specific to my configuration, but I thought someone out there might benefit from this discussion, since there's no mention of this issue on the internet and surely at least one other person must have experienced it?

I have a Macbook Pro M1 running macOS Monterey. After installing Pedalboard via Pip, I immediately get a Segmentation fault on import:

> python --version
Python 3.9.10
> pip install pedalboard  # installs version 0.7.6 but I have tried with other versions to same result.
> python -m pedalboard
Segmentation fault: 11 

Not even really sure where to begin debugging, but I guess I'll download the source and try to understand where in the Pedalboard code the Segmentation fault is happening.

Not sure if this helps, but I've turned on fault handler: export PYTHONFAULTHANDLER=1 and I get a bit more output:

>>> import pedalboard
Fatal Python error: Segmentation fault

Current thread 0x000000010579c580 (most recent call first):
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1173 in create_module
  File "<frozen importlib._bootstrap>", line 565 in module_from_spec
  File "<frozen importlib._bootstrap>", line 666 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/Users/lex/.env/lib/python3.9/site-packages/pedalboard/__init__.py", line 25 in <module>
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 850 in exec_module
  File "<frozen importlib._bootstrap>", line 680 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 972 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "<stdin>", line 1 in <module>
Segmentation fault: 11

I upgraded from Montery to Ventura 13.5

Now i get a new error:

> python -m pedalboard
Fatal Python error: Bus error

Current thread 0x00000001ecf0e080 (most recent call first):
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1173 in create_module
  File "<frozen importlib._bootstrap>", line 565 in module_from_spec
  File "<frozen importlib._bootstrap>", line 666 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/Users/lex/.env/lib/python3.9/site-packages/pedalboard/__init__.py", line 25 in <module>
  File "<frozen importlib._bootstrap>", line 228 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 850 in exec_module
  File "<frozen importlib._bootstrap>", line 680 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 986 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1007 in _find_and_load
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/runpy.py", line 111 in _get_module_details
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/runpy.py", line 147 in _get_module_details
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.9/runpy.py", line 188 in _run_module_as_main
Bus error: 10

Hi @lextoumbourou! I’m a bit perplexed, as we do Pedalboard development on Apple Silicon machines and have seen no similar issues on import.

One thing to try might be using gdb or lldb to launch Python, which could give you more information about where in the C code the error is coming from:

lldb -- python -c “import pedalboard”

…however, we do strip debug symbols from the packages on PyPI, so this may not be as useful as hoped.

I deleted my env and reinstalled Python. After that, I reinstalled Pedalboard from pip and it's working perfectly. Not sure what happened, but it seems unique to my environment. I'll close the issue.