Skip to content

[Bug] Illegal hardware instruction #607

Closed

Description

@e16m
  • [O ] I didn't find a similar issue already open.
  • [O] I read the documentation (README AND Wiki)
  • [O] I have installed FFMpeg
  • [O] My problem is related to Spleeter only, not a derivative product (such as Webapplication, or GUI provided by others)

Description

On a windows PC, I was able to successfully run a command using 'spleeter separator test.mp3'. However, on my mac which runs macOS Big Sur with Apple M1, I get the following error when running the same command: zsh: illegal hardware instruction

My question is, is spleeter incompatible with Big Sur or Apple M1? I found that this was the case for tensorflow, and I'm curious if there is any way around this to run spleeter on my mac. Thanks.

Step to reproduce

  1. Installed using pip with python 3.8
  2. Ran as 'spleeter separator test.mp3' on terminal
  3. Got 'illegal hardware instruction' error

Output

When I run the script I get the following error: zsh: illegal hardware instruction
My expectation was that it would run the same as on my PC, with a success message.

Environment

OS macOS Big Sur Version 11.1
Installation type pip
RAM available 16 GB
Hardware spec -

Additional context

Activity

  1. added
    bugSomething isn't working
    invalidThis doesn't seem right
    on Apr 8, 2021
  2. romi1502 commented on Apr 15, 2021

    @romi1502
    Member

    Hi @rappercodes,
    we have not tested spleeter on Apple M1 yet, and it is very likely that the issue comes from an incompatibility issue.
    We have no M1 available at the moment to investigate on this issue, but if you find any hints about what could fix the issue, let us know.

  3. e16m commented on Apr 15, 2021

    @e16m
    Author

    Thanks @romi1502. It does seem like an incompatibility issue. If I do come across anything I will share here.

  4. Faylixe commented on Apr 15, 2021

    @Faylixe
    Contributor

    I confirm that Tensorflow compatibility with Apple M1 chip is not available at the moment, you can find some workaround based on Rosetta 2 here.

    Do not hesitate to tell us if you manage to make it work with Rosetta, otherwise we will just wait a TF release that is compatible with M1 :)

  5. d-dawg78 commented on Apr 28, 2021

    @d-dawg78
    Contributor

    For those of you who want to run Spleeter on a Mac with M1 chips, you may find a guide for installing TF here:

    https://drive.google.com/drive/folders/1oSipZLnoeQB0Awz8U68KYeCPsULy_dQ7?usp=sharing

    And a guide for building and installing Spleeter here:

    https://drive.google.com/drive/folders/1ioRr6-xRNizoR7xqWxXUdgjoijFOd2SC?usp=sharing

    Note that this is a temporary fix, until TF is updated to run on these new chips. Enjoy!

  6. kode54 commented on Oct 4, 2021

    @kode54

    Any updates?

  7. konglong87 commented on Oct 29, 2021

    @konglong87

    ?

  8. kpatdev commented on Nov 14, 2021

    @kpatdev

    Anyone able to build a whl file for an M1 Pro running python 3.9? I can't seem to get it to build with bazel. Keeps erroring out. Super annoying. Not sure why this issue is closed. It should remain OPEN until there is an easier way to get this to run on M1...

    Edit:

    The error has to do with numpy (Executing genrule @local_config_python//:numpy_include failed (Exit 1)).

    Trying some workarounds I saw but so far its been rough trying to get this to build through bazel.

  9. vumaasha commented on Dec 10, 2021

    @vumaasha

    is it possible to use dockerized images to workaround M1 specific issue?

  10. tartale commented on Dec 11, 2021

    @tartale

    FWIW, I found this guide for tensorflow:
    https://betterprogramming.pub/installing-tensorflow-on-apple-m1-with-new-metal-plugin-6d3cb9cb00ca

    I'm going to still follow the workaround for spleeter, but if having a native M1 tensorflow install was a blocker, it may no longer be.

  11. overdub60 commented on Jan 12, 2022

    @overdub60

    Unfortunately, none of the suggested solutions have been working for me. Would really like this to work in my M1.

  12. sslupsky commented on Jan 23, 2022

    @sslupsky

    I am attempting to install Spleeter on a MBP with M1 Max.

    Apple published details of how to install Tensorflow on Apple Silicon Macs with Tensorflow Pluggable Device support for Metal here:

    https://developer.apple.com/metal/tensorflow-plugin/

    That installed Tensorflow 2.7.0

    Name: tensorflow-macos
    Version: 2.7.0
    Summary: TensorFlow is an open source machine learning framework for everyone.
    Home-page: https://www.tensorflow.org/
    Author: Google Inc.
    Author-email: packages@tensorflow.org
    License: Apache 2.0
    Location: /Users/stevenslupsky/miniforge3/lib/python3.9/site-packages
    Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, keras, keras-preprocessing, libclang, numpy, opt-einsum, protobuf, six, tensorboard, tensorflow-estimator, termcolor, typing-extensions, wheel, wrapt
    Required-by: 
    

    I installed ffmpeg and libsndfile successfully. When installing spleeter, I see an enormous number of error messages. At the end is the following:

    ERROR: Cannot install spleeter==2.1.0 and spleeter==2.3.0 because these package versions have conflicting dependencies.
    
    The conflict is caused by:
        spleeter 2.3.0 depends on tensorflow==2.5.0
        spleeter 2.1.0 depends on pandas==1.1.2
    
    To fix this you could try to:
    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict
    
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
    
  13. d-dawg78 commented on Jan 25, 2022

    @d-dawg78
    Contributor

    Hi all,

    We, at Deezer, managed to use Spleeter on Mac M1 using Tensorflow Metal. Here are the instructions you must follow in order to complete the installation.

    1. Upgrade your mac OS to Monterey (12.0.0+).
    2. Switch to a Rosetta terminal.
    3. Install Python 3.8. For now, we have not managed to run Metal on Python 3.9+, and Metal does not work for versions pre-3.8.
    4. Download the .whl file that can be found here, and run the following command:
      python -m pip install --upgrade spleeter-2.3.0b0-cp38-cp38-macosx_11_0_x86_64.whl
      Note that python refers to your local python3 installation. We recommend uninstalling the packages you have installed locally to avoid potential conflicting dependencies. Run the following a few times:
    python -m pip freeze > requirements.txt
    python -m pip uninstall -r requirements.txt -y
    
    1. Test your new Spleeter installation using:
      python -m spleeter separate -p spleeter:2stems -o output audio_example.mp3
      You can check your Activity Monitor to see the GPU being used.

    We have also created branch for local development using Metal. Please run the following:

    git clone https://github.com/Deezer/spleeter && cd spleeter
    git fetch --all
    git checkout tf_metal
    

    You are free to edit and update the dependencies in pyproject.toml and build your own .whl files using poetry install and poetry build (poetry tutorial).

    Finally, please send us your feedback in the comments below. A more substantial release may follow if this fix ends up working for you!

  14. 11 remaining items

  15. adude007 commented on Jul 2, 2023

    @adude007

    Hi all,

    We, at Deezer, managed to use Spleeter on Mac M1 using Tensorflow Metal. Here are the instructions you must follow in order to complete the installation.

    1. Upgrade your mac OS to Monterey (12.0.0+).
    2. Switch to a Rosetta terminal.
    3. Install Python 3.8. For now, we have not managed to run Metal on Python 3.9+, and Metal does not work for versions pre-3.8.
    4. Download the .whl file that can be found here, and run the following command:
      python -m pip install --upgrade spleeter-2.3.0b0-cp38-cp38-macosx_11_0_x86_64.whl
      Note that python refers to your local python3 installation. We recommend uninstalling the packages you have installed locally to avoid potential conflicting dependencies. Run the following a few times:
    python -m pip freeze > requirements.txt
    python -m pip uninstall -r requirements.txt -y
    
    1. Test your new Spleeter installation using:
      python -m spleeter separate -p spleeter:2stems -o output audio_example.mp3
      You can check your Activity Monitor to see the GPU being used.

    We have also created branch for local development using Metal. Please run the following:

    git clone https://github.com/Deezer/spleeter && cd spleeter
    git fetch --all
    git checkout tf_metal
    

    You are free to edit and update the dependencies in pyproject.toml and build your own .whl files using poetry install and poetry build (poetry tutorial).

    Finally, please send us your feedback in the comments below. A more substantial release may follow if this fix ends up working for you!

    For all those that followed these instructions and had some troubles here is what I did that got this working on my 2020 M1 Mac Mini on 13.4.1.

    To get a rosetta terminal: First, open a terminal and then use command

    arch -x86_64 zsh
    

    check with arch and the response should be i386 if you are now in a rosetta terminal.

    Follow the instructions quoted above to run the command to install Spleeter to your python install

    Don't bother running these two commands. They just uninstall everything installed to your python install.

    python -m pip freeze > requirements.txt
    python -m pip uninstall -r requirements.txt -y
    

    On my first run of the spleeter tool I had an issue where the version of protobuf that came with the whl command step was too new. So I downgraded that to 3.20.1 but you could use any stable 3.20.* version

    python -m pip install protobuf==3.20.*
    

    Then I was getting an error that ffmpeg binary not installed.

    I installed homebrew from brew.sh in an arm64 terminal

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

    Use homebrew to Install ffmpeg with command

    brew install ffmpeg
    

    Then back in a rosetta terminal I was able to run the spleeter command successfully

    python -m spleeter separate -p spleeter:2stems -o output audio_example.mp3

  16. BeatBoxerLrd commented on Dec 27, 2023

    @BeatBoxerLrd

    Hi all,

    We, at Deezer, managed to use Spleeter on Mac M1 using Tensorflow Metal. Here are the instructions you must follow in order to complete the installation.

    1. Upgrade your mac OS to Monterey (12.0.0+).
    2. Switch to a Rosetta terminal.
    3. Install Python 3.8. For now, we have not managed to run Metal on Python 3.9+, and Metal does not work for versions pre-3.8.
    4. Download the .whl file that can be found here, and run the following command:
      python -m pip install --upgrade spleeter-2.3.0b0-cp38-cp38-macosx_11_0_x86_64.whl
      Note that python refers to your local python3 installation. We recommend uninstalling the packages you have installed locally to avoid potential conflicting dependencies. Run the following a few times:
    python -m pip freeze > requirements.txt
    python -m pip uninstall -r requirements.txt -y
    
    1. Test your new Spleeter installation using:
      python -m spleeter separate -p spleeter:2stems -o output audio_example.mp3
      You can check your Activity Monitor to see the GPU being used.

    We have also created branch for local development using Metal. Please run the following:

    git clone https://github.com/Deezer/spleeter && cd spleeter
    git fetch --all
    git checkout tf_metal
    

    You are free to edit and update the dependencies in pyproject.toml and build your own .whl files using poetry install and poetry build (poetry tutorial).

    Finally, please send us your feedback in the comments below. A more substantial release may follow if this fix ends up working for you!

    hi
    mac info:
    Apple M1 Pro
    macOs ventura 13.0
    python version:3.8.18

    I cannot install this whl.

    python m pip install --upgrade spleeter-2.3.0b0-cp38-cp38-macosx_11_0_x86_64.whl
    ERROR: spleeter-2.3.0b0-cp38-cp38-macosx_11_0_x86_64.whl is not a supported wheel on this platform.

    run arch -x86_64 zsh
    No display

    thank you!!!

  17. nihavend commented on May 26, 2024

    @nihavend

    I made it work on M1 Pro Max with 3.8.10 but had to downgrade protobuf to 3.20.3
    thanks

  18. iserdmi commented on Dec 6, 2024

    @iserdmi

    M1. In my case this commands was successful:

    conda create -n py38 python=3.8 -y
    conda activate py38
    conda install -c conda-forge ffmpeg libsndfile
    pip install spleeter
    
  19. bhkangw commented on Dec 10, 2024

    @bhkangw

    M1. In my case this commands was successful:

    conda create -n py38 python=3.8 -y
    conda activate py38
    conda install -c conda-forge ffmpeg libsndfile
    pip install spleeter
    

    THIS WORKED THANK YOU. CLAUDE PLS INDEX THIS FIX 😆

  20. bdotsamir commented on Jan 4, 2025

    @bdotsamir

    Getting the same issue as @BeatBoxerLrd. Trying to install from the .whl file fails with a "platform not supported" error, even with terminal running via Rosetta and arch set to x86_64 (i386)

  21. modestasgrz commented on Jan 8, 2025

    @modestasgrz

    M1. In my case this commands was successful:

    conda create -n py38 python=3.8 -y
    conda activate py38
    conda install -c conda-forge ffmpeg libsndfile
    pip install spleeter
    

    This worked on M3 Pro as well, thank you

  22. stelladrinkwater commented on Jan 8, 2025

    @stelladrinkwater

    M1. In my case this commands was successful:

    conda create -n py38 python=3.8 -y
    conda activate py38
    conda install -c conda-forge ffmpeg libsndfile
    pip install spleeter
    

    Worked on Mac M1 Pro on OS 15.1!

  23. acronomic commented on Feb 21, 2025

    @acronomic

    Hi I was able to install spleeter with the commands listed on a Mac M1 on Sonoma 14.7.:

    conda create -n py38 python=3.8 -y
    conda activate py38
    conda install -c conda-forge ffmpeg libsndfile
    pip install spleeter
    

    However, I cannot run spleeter as I keep getting this message:

    ../spleeter2025/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

    My python interpreter is definitely arm64, but this _cffi_backend.cpython-38-darwin.so is x86_64. I've tried to install it both using miniconda and miniforge3, but this cffi_backend seems to remain as a x86_64 file.

    Any help would be appreciated. Thank you.

  24. irorange27 commented on Apr 20, 2025

    @irorange27

    M1. In my case this commands was successful:

    conda create -n py38 python=3.8 -y
    conda activate py38
    conda install -c conda-forge ffmpeg libsndfile
    pip install spleeter
    

    M4 works. Thanks.

  25. madmecodes commented on May 21, 2025

    @madmecodes
    pip install spleeter
    

    thnx worked on M2 air too, pip was giving trouble, dependency issues

  26. Shravanthh commented on Jul 6, 2025

    @Shravanthh
    conda create -n py38 python=3.8 -y
    
    conda activate py38
    
    conda install -c conda-forge ffmpeg libsndfile
    
    pip install spleeter
    

    This works for M4 mac running macOS 26

  27. davingee commented on Jul 21, 2025

    @davingee

    Thank you Shravanthh works for me too! i spent quite a while trying to get this installed.

  28. sxlijin commented on Aug 14, 2025

    @sxlijin
    conda create -n py38 python=3.8 -y
    conda activate py38
    conda install -c conda-forge ffmpeg libsndfile
    pip install spleeter
    

    This also works for me, and I also get a substantial performance boost when I also pip install tensorflow-metal.

    I suspect this is because py38 is so old that a lot of the packages in the transitive closure end up on versions with aggressively stable compatibility guarantees and it also bypasses features in the newer TF versions (in fact, following apple's instructions for TF metal fail for me on py310, py311, and py312 - so that's fun).

  29. itsmedonttell commented on Aug 30, 2025

    @itsmedonttell

    This also works for me, and I also get a substantial performance boost when I also pip install tensorflow-metal.

    I don't think that you do.

    Apple states (via Get started with tensorflow-metal) that V1 TensorFlow networks (i.e., Spleeter) are not currently supported, and when running Spleeter I see no GPU usage by it or any of its spawned processes. Furthermore, because tensorflow-metal doesn't support V1 networks, you can't just move the model to the GPU (well, you can try, but I hope you enjoy frustration and reading long tracebacks).

    Without transitioning the network to V2 or using the checkpoints elsewhere, it seems everyone on a Mac is running this code on the CPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions