birdnetlib
birdnetlib copied to clipboard
NumPy conflict for Analyzer()
Dear Mr. Weiss, I just tried your code from 6.2 of https://github.com/kahst/BirdNET-Analyzer. My system is bookworm 64bit on RPi4B. I installed all the libraries into a venv and started your example.py from there. It says:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "/home/pi/audiostation/birdnet.py", line 7, in <module>
analyzer = Analyzer()
File "/home/pi/herbvenv/lib/python3.11/site-packages/birdnetlib/analyzer.py", line 122, in __init__
self.load_model()
File "/home/pi/herbvenv/lib/python3.11/site-packages/birdnetlib/analyzer.py", line 386, in load_model
self.interpreter = tflite.Interpreter(
File "/home/pi/herbvenv/lib/python3.11/site-packages/tflite_runtime/interpreter.py", line 464, in __init__
self._interpreter = _interpreter_wrapper.CreateWrapperFromFile(
AttributeError: _ARRAY_API not found
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/pi/audiostation/birdnet.py", line 7, in <module>
analyzer = Analyzer()
^^^^^^^^^^
File "/home/pi/herbvenv/lib/python3.11/site-packages/birdnetlib/analyzer.py", line 122, in __init__
self.load_model()
File "/home/pi/herbvenv/lib/python3.11/site-packages/birdnetlib/analyzer.py", line 386, in load_model
self.interpreter = tflite.Interpreter(
^^^^^^^^^^^^^^^^^^^
File "/home/pi/herbvenv/lib/python3.11/site-packages/tflite_runtime/interpreter.py", line 464, in __init__
self._interpreter = _interpreter_wrapper.CreateWrapperFromFile(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: <built-in method CreateWrapperFromFile of PyCapsule object at 0x7f6f7a95c0> returned a result with an exception set
What should I do? Thanks for any hints, H.Betz (Germany)