pyannote-audio icon indicating copy to clipboard operation
pyannote-audio copied to clipboard

Install problem on M1

Open PierreVannier opened this issue 1 year ago • 9 comments

Hi,

It seems this error is related to #1306. I'm running an M1 pro with the following pip list => pyannote.audio 2.1.1 pyannote.core 4.5 pyannote.database 4.1.3 pyannote.metrics 3.2.1 pyannote.pipeline 2.3 torch 2.0.0

python --version
Python 3.10.10
pip install pyannote-audio
$python
Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:12:31) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyannote.audio import Pipeline
/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torchaudio/_internal/module_utils.py:99: UserWarning: Failed to import soundfile. 'soundfile' backend is not available.
  warnings.warn("Failed to import soundfile. 'soundfile' backend is not available.")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/pyannote/audio/__init__.py", line 29, in <module>
    from .core.inference import Inference
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/pyannote/audio/core/inference.py", line 34, in <module>
    from pyannote.audio.core.io import AudioFile
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/pyannote/audio/core/io.py", line 38, in <module>
    import torchaudio
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torchaudio/__init__.py", line 1, in <module>
    from torchaudio import (  # noqa: F401
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torchaudio/_extension.py", line 135, in <module>
    _init_extension()
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torchaudio/_extension.py", line 105, in _init_extension
    _load_lib("libtorchaudio")
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torchaudio/_extension.py", line 52, in _load_lib
    torch.ops.load_library(path)
  File "/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torch/_ops.py", line 643, in load_library
    ctypes.CDLL(path)
  File "/Users/pierrevannier/miniforge3/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torchaudio/lib/libtorchaudio.so, 0x0006): Symbol not found: __ZN2at4_ops9_pad_enum4callERKNS_6TensorEN3c108ArrayRefIxEExNS5_8optionalIdEE
  Referenced from: <BE6EA463-573E-3D7C-9087-E19500344FCD> /Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torchaudio/lib/libtorchaudio.so
  Expected in:     <78DA4C67-8BC7-3995-8324-D2FD95E57BA4> /Users/pierrevannier/miniforge3/lib/python3.10/site-packages/torch/lib/libtorch_cpu.dylib

PierreVannier avatar Apr 10 '23 19:04 PierreVannier

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

github-actions[bot] avatar Apr 10 '23 19:04 github-actions[bot]

Hi, @PierreVannier I'm facing the same problem using Poetry and Python 3.10.* on an M1 Mac.

Until it's fully compatible, I would stick to Python 3.9 and Torch 1.13. Because pyannote.audio has a strict version constraint: torchaudio >=0.10,<1.0

chainyo avatar Apr 11 '23 07:04 chainyo

Hi, @PierreVannier I'm facing the same problem using Poetry and Python 3.10.* on an M1 Mac.

Until it's fully compatible, I would stick to Python 3.9 and Torch 1.13. Because pyannote.audio has a strict version constraint: torchaudio >=0.10,<1.0

Thanks @chainyo ! I got many troubles on M1 install (even with strict torch version check), it’s causing errors when importing pipelines (after a correct install). Also hmmlearn isn’t installing properly… I guesse M1 isn’t the way to go for this module 😔

PierreVannier avatar Apr 12 '23 16:04 PierreVannier

@PierreVannier On M1, I had problems with torch>=2 and hmmlearn. I was able to get my project running by changing the requirements to install torch<2 (thanks to @chainyo above) and hmmlearn main branch from git:

-e git+https://github.com/hmmlearn/hmmlearn.git#egg=hmmlearn

See: https://github.com/hmmlearn/hmmlearn/issues/514#issuecomment-1494179213

mrmachine avatar Apr 13 '23 02:04 mrmachine

Package hmmlearn 0.3.0 has been released, which will solve the issue about installing on M1 Mac. However, pyannote-audio 2.1.1 seems to require hmmlearn < 0.3, so installing pyannote-audio still does not work. Why not loosen the version constraints?

https://github.com/pyannote/pyannote-audio/blob/master/requirements.txt#L4

monaqa avatar Apr 24 '23 03:04 monaqa

I can confirm that this fix works on M1 Pro. My issue was with hmmlearn as well.

cwazuidema avatar Jul 14 '23 10:07 cwazuidema

Since the pull request is still not closed I was able to install pyannote.audio with pip install -c constraints.txt pyannote.audio, where I put hmmlearn>=0.3.0 in the constraints.txt.

martinjurkovic avatar Jul 30 '23 17:07 martinjurkovic

Thanks Farissoliman, this fixed the issue (also for M2 chips). For those using poetry:

pyannote-audio = {git = "https://github.com/Farissoliman/pyannote-audio.git", rev = "patch-1"}

tomklaverpon avatar Aug 23 '23 08:08 tomklaverpon

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 19 '24 20:02 stale[bot]