spleeter icon indicating copy to clipboard operation
spleeter copied to clipboard

Installation Issues Mac M1

Open acronomic opened this issue 4 years ago • 3 comments

Hi, I've been trying to install spleeter on my mac m1 for over a week now and I'm a bit lost on why some have had success, and I can't seem to get it to work. I've followed this discussion as well as this one.

I am successful in installing tensorflow-macOs 2.5 as well as 2.6 for mac, as well as metal and all the other dependencies but running spleeter always fails, with a 6 leaked semaphores issue.

I have tried various combinations of tensorflow-MacOS with different versions of python, as well as different branches of spleeter (v2.3.0 / v2.3.2 / metal branch), but nothing seems to work.

One thought I had is that tensorflow might be breaking when running poetry update, since it automatically updates numpy and some other dependencies. However, I am able to run a test "print(tf.reduce_sum(tf.random.normal([10000,1000]))) which shows that it is working and using the metal / mps gpu on mac.

Lastly, I tried to install with rosetta, but the wheel provided in the discussion failed. I also tried to create one using poetry in the Rosetta terminal but this also failed.

Any suggestions on how to solve this 6 leaked semaphores issue, or an environment that I might have most success with? (Python version / tensorflow-macOs version / spleeter version). At this point, I feel like I'm just striking out in the dark hoping something hits, but haven't had any luck yet.

Thank you -Michael

acronomic avatar Oct 17 '22 13:10 acronomic

Hey,

Have you tried to run Spleeter in a Python environment? Or a poetry shell? If I remember correctly, the leaked semaphore issue does not occur in these cases.

d-dawg78 avatar Oct 27 '22 16:10 d-dawg78

Hi, I tried running Spleeter in multiple conda environments, but none of them seem to work. Most have leaked semaphore issues, others have dependency issues. Would you recommend version of python / tensorflow / Spleeter (v2.3.0 or v2.3.2 or the Metal Fork?)? At least if I have a starting point I can try a few more times from a good footing. I'm not too familiar with poetry. When I try to run poetry shell within the conda environment, it says the conda virtual environment is already activated.

Thanks for responding.

acronomic avatar Oct 28 '22 13:10 acronomic

Hi, I'm just getting started with Spleeter on an M3 (same arch as M1), and I just wanted to share a setup that worked for me using tensorflow-metal, off of the master branch. Assumes you're using pyenv/virtualenv. Just need to make a 1 line change to the pyproject.toml to have it look for tensorflow-macos instead of tensorflow.

diff --git a/pyproject.toml b/pyproject.toml
index db723e6..20a5fe1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -51,7 +51,7 @@ httpx = {extras = ["http2"], version = "^0.19.0"}
 typer = "^0.3.2"
 musdb = {version = "^0.4.0", optional = true}
 museval = {version = "^0.4.0", optional = true}
-tensorflow = "^2.5.0, <2.10.0"
+tensorflow-macos = "^2.5.0, <2.10.0"
 pandas = "^1.3.0"
 norbert = "^0.2.1"
$ pyenv install 3.10.13
$ pyenv local 3.10.13
$ python -m venv spleeter-env
$ . spleeter-env/bin/activate
(spleeter-env) $ pip install tensorflow-macos==2.9.2 tensorflow-metal==0.5.0 # install tf deps explicitly
(spleeter-env) $ pip install . # install spleeter from root of the source tree

now you should be able to run commands from that env, eg. python -m spleeter separate -o audio_output -p spleeter:4stems audio_example.mp3

jonbender avatar Jan 24 '24 17:01 jonbender