question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Spleeter seems to be in an endless loop while separating audio

See original GitHub issue

I’m trying to separate an audio into 2 stems, using spleeter.Separator.separate_to_file.

Installed using pip. Run via py. Got this error (I get this error repeatedly, until I terminate the script):

  File "C:\Users\Myzel394\PycharmProjects\yt2stem\seperate_test.py", line 4, in <module>
    separator = Separator("spleeter:2stems")
  File "C:\Program Files\Python37\lib\site-packages\spleeter\separator.py", line 47, in __init__
    self._pool = Pool()
  File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 119, in Pool
    context=self.get_context())
  File "C:\Program Files\Python37\lib\multiprocessing\pool.py", line 176, in __init__
    self._repopulate_pool()
  File "C:\Program Files\Python37\lib\multiprocessing\pool.py", line 241, in _repopulate_pool
    w.start()
  File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Program Files\Python37\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
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.

Here’s my code:

from spleeter.separator import Separator


separator = Separator("spleeter:2stems")

separator.separate_to_file("audio.mp3", "/sep_output")

audio.mp3 is the given example.

OS Windows
Installation type pip
RAM available 32 GB, about 20 GB available
Hardware spec GPU: AMD Radeon R9 200 Series, CPU: Intel i5-4460

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
Faylixecommented, Nov 19, 2019

The problem occurs because Separator class use multiprocessing module which is not fully supported as in with Windows. Since Windows do not support os.fork. as for UNIX system you should guard your script with an entry point :

from spleeter.separator import Separator

if __name__ == '__main__':
    separator = Separator("spleeter:2stems")
    separator.separate_to_file("audio.mp3", "/sep_output")
0reactions
HaujetZhaocommented, Jan 5, 2021

The problem occurs because Separator class use multiprocessing module which is not fully supported as in with Windows. Since Windows do not support os.fork. as for UNIX system you should guard your script with an entry point :

from spleeter.separator import Separator

if __name__ == '__main__':
    separator = Separator("spleeter:2stems")
    separator.separate_to_file("audio.mp3", "/sep_output")

Using this code and ran from console still got the same problem, but why python -m spleeter separate ······ could run?

Read more comments on GitHub >

github_iconTop Results From Across the Web

OBS - Fix Infinite Audio Loop - YouTube
To those it seems simple to - yes. But to those who keep asking - here you go.▻▻ NOTE!!! This is a VERY...
Read more >
Spleeter web server now creates stems 100x faster... a normal ...
Hi guys, I made a post here a while ago asking for some feedback on my website https://ezstems.com which is a way for...
Read more >
Reference Manual - Roland
specified by SPLIT are ignored. Loop Hold. OFF, ON. This lets you loop the playback while holding the audio that is loaded into...
Read more >
UNICORN 5.0 User Reference Manual
The user documentation for UNICORN is divided into three separate manuals. ... will generate a potentially infinite loop that exceeds the maximum.
Read more >
GWT Release Notes
Fix loading bug in waitForBodyLoaded.js; Fix NPE compiling code with a ... (7791); Fixed an infinite loop in server-side GWT-RPC when deserializing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found