pddpauw / BirdPi

A realtime acoustic bird classification system for the Raspberry Pi 5, based on BirdNET-Pi
Other
29 stars 6 forks source link

Seeing issues with NumpyCore multiarray import #5

Open krishfhc opened 2 months ago

krishfhc commented 2 months ago

Describe the bug Hello! I am seeing some weirdness in the logs of my Birdnet Pi local setup. In essence, it seems like there is an import issue going on, potentially related to a NumPy package versioning issue. It seems like @soundlab recently ran into a similar issue, reported here.

To Reproduce I am able to use almost all functionality on my local, but the logs don't look how I'd expect them to.

my logs:

Screenshot 2024-06-30 at 5 13 29 PM

logs that look how I'd expect them to (from here)

Screenshot 2024-06-30 at 5 15 49 PM

Expected behavior As a result of these issues I think my setup is having trouble storing sounds. When I use the "listen live" functionality, I hear what I'd expect to. It just seems like this issue is causing problems in the storage and classification of the sounds, which is certainly a blocker. Thank you so much for all your help!

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem or your installation here.

Your build I am running on a Raspberry Pi Model 4B, with the 64bit LITE Bookworm OS installed.

Code or log snippets log screenshots above, but pasted here as well in case it's useful.

-SystemError: <built-in method CreateWrapperFromFile of PyCapsule object at 0x7f8c0c6280> returned a result with an exception set
17:14:42---A module that was compiled using NumPy 1.x cannot be run in
17:14:42---NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
17:14:42---versions of NumPy, modules must be compiled with NumPy 2.0.
17:14:42---Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
17:14:42---If you are a user of the module, the easiest solution will be to
17:14:42---downgrade to 'numpy<2' or try to upgrade the affected module.
17:14:42---We expect that some modules will need time to support NumPy 2.
17:14:42---Traceback (most recent call last):  File "/usr/local/bin/server.py", line 635, in <module>
17:14:42---    start()
17:14:42---  File "/usr/local/bin/server.py", line 624, in start
17:14:42---    INTERPRETER = loadModel()
17:14:42---  File "/usr/local/bin/server.py", line 77, in loadModel
17:14:42---    myinterpreter = tflite.Interpreter(model_path=modelpath, num_threads=2)
17:14:42---  File "BirdNET-Pi/birdnet/lib/python3.11/site-packages/tflite_runtime/interpreter.py", line 464, in __init__
17:14:42---    self._interpreter = _interpreter_wrapper.CreateWrapperFromFile(
17:14:42---AttributeError: _ARRAY_API not found
17:14:42---LOADING TF LITE MODEL... ImportError: numpy.core.multiarray failed to import
17:14:42---The above exception was the direct cause of the following exception:
17:14:42---Traceback (most recent call last):
17:14:42---  File "/usr/local/bin/server.py", line 635, in <module>
17:14:42---    start()
17:14:42---  File "/usr/local/bin/server.py", line 624, in start
17:14:42---    INTERPRETER = loadModel()
17:14:42---                  ^^^^^^^^^^^
17:14:42---  File "/usr/local/bin/server.py", line 77, in loadModel
17:14:42---    myinterpreter = tflite.Interpreter(model_path=modelpath, num_threads=2)
17:14:42---                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17:14:42---  File "BirdNET-Pi/birdnet/lib/python3.11/site-packages/tflite_runtime/interpreter.py", line 464, in __init__
17:14:42---    self._interpreter = _interpreter_wrapper.CreateWrapperFromFile(
soundlab commented 2 months ago

Thanks @krishfhc I am seeing the exact same issue on an R Pi 5 setup. I tried installing the last version of Numpy (1.26) but that did not have any effect on the issue. It looks like the GUI, audio, and everything are running fine but the interpreter is not correctly loading or deploying. Not sure what to debug next!

rdowden2 commented 2 months ago

Hi,

I just did a new install and I am seeing the same thing!

Roger

jduanen commented 2 months ago

I had the same problem and it seems like the breaking changes in numpy 2.0 are to blame. I did the following and things work fine for me.

source ./birdnet/bin/activate pip uninstall numpy pip install numpy==1.24.2

rdowden2 commented 2 months ago

Hi,

Thank you jduanen, you are correct, uninstalling the new version and installing the old version resolved the issue for me too.

Regards

Roger

soundlab commented 2 months ago

Reverting to 1.24.2 worked and cleared that issue. Thank you!

I'm now seeing this error... I'm wondering if some part of the package wasn't installed correctly?

Screenshot 2024-07-05 at 3 05 49 PM
krishfhc commented 1 month ago

@soundlab I was seeing this issue, too. I tried a fresh installation, ran the commands @jduanen shared, and now things seem to be working for me. thank you all very much for your help and the discussion!

soundlab commented 1 month ago

@krishfhc I am still seeing the same issue, on a fresh install of @pddpauw's R Pi 5 repo and reverting to Numpy 1.24.2 as shown above. Any ideas what might be the issue here?

Not clear on how to track down the source of this error:

EOFError: Ran out of input

soundlab commented 1 month ago

Hello just to follow up here I switched to a Raspberry Pi 4B from the 5 and the @pddpauw repo along with reverting to Numpy 1.24.2 was successful! I was not able to make the above work on a 5.