deezer / deezer/spleeter

[Bug]Python code for spleeter basics does not work

Open
#825 6 comments 0 reactions 0 assignees View on GitHub
bug invalid
Dominant language
Python
Stars
28.4k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

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

## Description
Command line works but python code does NOT

**_Command line_**
PS C:\Users\...\Desktop> spleeter separate -p spleeter:2stems -o output .\ABCD.mp3
INFO:spleeter:File output\ABCD/accompaniment.wav written succesfully
INFO:spleeter:File output\ABCD/vocals.wav written succesfully

**_Python code_**
from spleeter.separator import Separator
from spleeter.audio.adapter import AudioAdapter

separator = Separator('spleeter:2stems')
audio_loader = AudioAdapter.default()
sample_rate = 44100
waveform, _ = audio_loader.load('C:/Users/.../Desktop/.../ABCD.mp3', sample_rate=sample_rate)

prediction1 = separator.separate(waveform)

## Step to reproduce
**_Python code_**
from spleeter.separator import Separator
from spleeter.audio.adapter import AudioAdapter

separator = Separator('spleeter:2stems')
audio_loader = AudioAdapter.default()
sample_rate = 44100
waveform, _ = audio_loader.load('C:/Users/.../Desktop/.../ABCD.mp3', sample_rate=sample_rate)

prediction1 = separator.separate(waveform)

1. Installed using `pip`
2. Run as `...`
3. Got `...` error

## Output

File "C:\Users\...\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.

This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:

if __name__ == '__main__':
freeze_support()
...

The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.

## Environment
Windows 11 Pro

| | |
| ----------------- | ------------------------------- |
| OS | Windows |
| Installation type | pip |
| RAM available | XGo |
| Hardware spec | GPU / CPU / etc ... |

## Additional context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.