dejavu icon indicating copy to clipboard operation
dejavu copied to clipboard

Fingerprinting fails because `numpy boolean subtract` deprecated

Open alanbernstein opened this issue 8 years ago • 10 comments

I'm trying to use dejavu for the first time (just djv.fingerprint_directory(audio_path, [".mp3"], 3)), and it seems to fail on all files. I see output like this:

$ python dejavu-scan.py
~/venvs/dejavu/lib/python2.7/site-packages/dejavu/database_sql.py:158: Warning: Table 'songs' already exists
  cur.execute(self.CREATE_SONGS_TABLE)
~/venvs/dejavu/lib/python2.7/site-packages/dejavu/database_sql.py:159: Warning: Table 'fingerprints' already exists
  cur.execute(self.CREATE_FINGERPRINTS_TABLE)
Fingerprinting channel 1/2 for ~/audio/file-1.mp3
~/venvs/dejavu/lib/python2.7/site-packages/dejavu/fingerprint.py:86: RuntimeWarning: divide by zero encountered in log10
  arr2D = 10 * np.log10(arr2D)
Fingerprinting channel 1/2 for ~/audio/file-2.mp3
Fingerprinting channel 1/2 for ~/audio/file-3.mp3
Failed fingerprinting
Traceback (most recent call last):
  File "~/venvs/dejavu/lib/python2.7/site-packages/dejavu/__init__.py", line 77, in fingerprint_directory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 668, in next
    raise value
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.

The Failed fingerprinting and traceback repeat as long as I let the process go.

alanbernstein avatar Apr 01 '18 14:04 alanbernstein

You should use numpy==1.13.3 to avoid this problem

JPery avatar Apr 04 '18 08:04 JPery

That seems to have worked. Should requirements.txt be updated?

alanbernstein avatar Apr 07 '18 01:04 alanbernstein

downgrade to 1.13.3, but I got another error: RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb ImportError: numpy.core.multiarray failed to import

JZT1299 avatar Jun 09 '18 09:06 JZT1299

    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

ii64 avatar Nov 12 '18 15:11 ii64

    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

really helpful, thanks a lot dude

jamesjasz avatar Dec 19 '18 17:12 jamesjasz

    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

really helpful, thanks a lot dude

but I got another error 'numpy.ndarray' object is not callable

image

ghostPath avatar Dec 21 '18 08:12 ghostPath

at fingerprint.py maybe thats help

really helpful, thanks a lot dude

but I got another error 'numpy.ndarray' object is not callable

Pretty sure you call the array (numpy version related) change the arr2D(detected_peaks) with arr2D[detected_peaks]

or could you take a look to @DataWookie's fork? https://github.com/DataWookie/dejavu

ii64 avatar Dec 27 '18 15:12 ii64

You should use numpy==1.13.3 to avoid this problem

This will solve it, no error.

madhavtummala avatar Mar 19 '19 07:03 madhavtummala

    local_max = local_max.astype(np.float32)
    eroded_background = eroded_background.astype(np.float32)
    detected_peaks = local_max - eroded_background
    detected_peaks = detected_peaks.astype(np.bool)

at fingerprint.py maybe thats help

Yes. That helped. Thanks a lot

sunravi avatar Apr 30 '19 07:04 sunravi

You should use numpy==1.13.3 to avoid this problem

This will solve it, no error.

I tried this. But for some reason, I was unable to downgrade numpy. Winpython was throwing lot of errors

sunravi avatar Apr 30 '19 07:04 sunravi