Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: numpy boolean subtract, the - operator, is deprecated, use the bitwise_xor, the ^ operator, or the logical_xor function instead. #192

Closed
zockerwurf opened this issue Apr 11, 2019 · 6 comments · Fixed by #193

Comments

@zockerwurf
Copy link

Hi guys

When i run "python example.py" i get the following errors:

edward@edward-virtual-machine:~/dejavu$ python example.py
Fingerprinting channel 1/2 for mp3/Sean-Fournier--Falling-For-You.mp3
Fingerprinting channel 1/2 for mp3/The-Lights-Galaxia--While-She-Sleeps.mp3
Fingerprinting channel 1/2 for mp3/Brad-Sucks--Total-Breakdown.mp3
Failed fingerprinting
Traceback (most recent call last):
  File "/home/edward/dejavu/dejavu/__init__.py", line 77, in fingerprint_directory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 673, in next
    raise value
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.
Fingerprinting channel 1/2 for mp3/Choc--Eigenvalue-Subspace-Decomposition.mp3
Failed fingerprinting
Traceback (most recent call last):
  File "/home/edward/dejavu/dejavu/__init__.py", line 77, in fingerprint_directory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 673, in next
    raise value
MemoryError
Failed fingerprinting
Traceback (most recent call last):
  File "/home/edward/dejavu/dejavu/__init__.py", line 77, in fingerprint_directory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 673, in next
    raise value
OSError: [Errno 12] Cannot allocate memory
Failed fingerprinting
Traceback (most recent call last):
  File "/home/edward/dejavu/dejavu/__init__.py", line 77, in fingerprint_directory
    song_name, hashes, file_hash = iterator.next()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 673, in next
    raise value
TypeError: numpy boolean subtract, the `-` operator, is deprecated, use the bitwise_xor, the `^` operator, or the logical_xor function instead.

What's wrong here?

@NathanielCustom
Copy link

The OSError tends to point toward not enough system memory. What are you running Dejavu on?
You can try telling Dejavu to only run one process to limit the amount of memory it tries to use.

@zockerwurf
Copy link
Author

The OSError tends to point toward not enough system memory. What are you running Dejavu on?
You can try telling Dejavu to only run one process to limit the amount of memory it tries to use.

Thanks for your message. I'm running it on Ubuntu.

How to tell Dejavu to run only one process?

@NathanielCustom
Copy link

NathanielCustom commented Apr 11, 2019

Sorry. I mean "what machine?" How much RAM does your system have?
I run Dejavu on a Raspberry Pi and will run out of memory sometimes.

Multiprocessing is a supported keyword argument when calling the fingerprint_directory function. I think you should find the function in the _ init _.py file.

@WillPastor
Copy link
Contributor

@zockerwurf @NathanielCustom
I fixed this problem by changing a single character in dejavu/fingerprint.py and it worked fine on my Ubuntu VirtualBox VM with about 8 GB memory. The code that needs to be changed is on line 104 of fingerprint.py ...

    # Boolean mask of arr2D with True at peaks
    detected_peaks = local_max - eroded_background

Needs to be changed to:

    # Boolean mask of arr2D with True at peaks
    detected_peaks = local_max ^ eroded_background

Side Note: I'm pretty new to Github, and this is my first contribution to someone else's repo, so I wasn't sure if I should push to a fork and submit a merge request with the fixed code, or if for such a small change a comment like this would be enough. I'd be interested to get an opinion on this since I'm still learning.

@NathanielCustom
Copy link

@WillPastor
I never messed around with correcting the TypeError, maybe my fork has that already corrected. Good to know. I note that you actually addressed Zockerwurf's topic question...

What stood out to me was the OSError, Failed Fingerprinting as I believe that to be what is stopping him from successfully using Dejavu.

@WillPastor
Copy link
Contributor

What stood out to me was the OSError, Failed Fingerprinting as I believe that to be what is stopping him from successfully using Dejavu.

@NathanielCustom
This may also be a problem, although for me atleast, Dejavu could not successfully fingerprint anything until I replaced the deprecated operator, which allowed it to work, even though the error message I was getting prior to that mentioned other files, issues, etc.
That said, RAM could still be an issue for him, although I would expect this to resolve everything else in his error message (I hope, at least), as it did for me. I'll try checking if it mentioned the OSError when I ran into this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants