I've inputted artifically made music with 120 bpm into:
y, sr = librosa.load(sys.argv[1])
tempo, beats = librosa.beat.beat_track(y,sr)
print("Tempo 1:", tempo)
first_beat_time, last_beat_time = librosa.frames_to_time((beats[0],beats[-1]),sr=sr)
print("Tempo 2:", 60/((last_beat_time-first_beat_time)/(len(beats)-1)))
With the output:
Tempo 1: 117.45383522727273
Tempo 2: 120.03683283914009
Shouldn't those numbers be the same, and almost equal to 120?
The algorithm is described in detail in the Beat Tracking by Dynamic Programming paper, as cited in the librosa docs. In essence:
The algorithm is deterministic, but in order to get precisely the same result, you'd need to make sure that exactly the same frames fit in a processing window (which they don't in your case).