0

I want to use two Python libraries, but they seem to be incompatible due to conflicting Numba requirements. I have found a workaround, but it's quite convoluted. I'm currently working in Google's Colab environment, but I don't think this is related to the issue. I just don't know how to reconcile the competing requirements for Numba. It appears that Spleeter wants one method that is deprecated later, and BeatNet wants a method that doesn't exist earlier.

Non Working Version

#Install Everything
!pip install spleeter
!pip install BeatNet
!apt-get -qq install -y portaudio19-dev
!pip install pyaudio
# uncommenting these just change the errors
#!pip install numba==0.56.4  
#!pip install numpy==1.22.4  

#Import Everything
from spleeter.separator import Separator 
from spleeter.audio.adapter import AudioAdapter
from BeatNet.BeatNet import BeatNet

import numpy as np
sample_stereo=np.array([[0.1, 0.2, 0.3, 0.2, 0.1],
                        [0.1, 0.2, 0.3, 0.2, 0.1]]).T

#Call Everything
separator = Separator('spleeter:5stems')
prediction = separator.separate(sample_stereo)

estimator = BeatNet(2, mode='offline', inference_model='DBN', plot=[], thread=False)
estimator.process(sample_stereo)

WorkAround. Only works if you run Spleeter before installing BeatNet

# This Works.
import numpy as np

# Install and Use Spleeter
!pip install spleeter

from spleeter.separator import Separator 
from spleeter.audio.adapter import AudioAdapter

sample_stereo=np.array([[0.1, 0.2, 0.3, 0.2, 0.1],
                        [0.1, 0.2, 0.3, 0.2, 0.1]]).T

separator = Separator('spleeter:5stems')
prediction = separator.separate(sample_stereo)

# Install and Use BeatNet
!pip install BeatNet
!apt-get -qq install -y portaudio19-dev
!pip install pyaudio
!pip install numba==0.56.4  #seems to be needed.
!pip install numpy==1.22.4  #seems to be needed.

from BeatNet.BeatNet import BeatNet
estimator = BeatNet(2, mode='offline', inference_model='DBN', plot=[], thread=False)
estimator.process(sample_stereo)

Somehow I'd arrived at the second version by trial and error.

But I'd like a way that both Spleeter and BeatNet could be used in any order.

user3735204
  • 81
  • 1
  • 8

0 Answers0