Numba unpickling fails (using librosa)

Hello,
I’m currently using librosa on a script embedded on a raspberryPi 4
Installing librosa installed numba version 0.57.1
I could do nothing else but install it directly in the target environment (couldn’t embed it in my Yocto)

My script consists of downsampling a wave file.
At script execution I get the following warning :

/usr/lib/python3.9/site-packages/numba/cpython/hashing.py:482: UserWarning: FNV hashing is not implemented in Numba. See PEP 456 https://www.python.org/dev/peps/pep-0456/ for rationale over not using FNV. Numba will continue to work, but hashes for built in types will be computed using siphash24. This will permit e.g. dictionaries to continue to behave as expected, however anything relying on the value of the hash opposed to hash as a derived property is likely to not work as expected.
  warnings.warn(msg)

Then execution fails with the following error:

File "/usr/lib/python3.9/site-packages/numba/core/caching.py", line 532, in _load_data
    tup = pickle.loads(data)
_pickle.UnpicklingError: invalid load key, '\x00'.

On the overall the scripts hangs for about 10s where it doesn’t when I launch it in my local linux.

I also had a warning at installation :
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
so I tried to do librosa installation in a virtual environment.
at execution, I still have the warning and hanging but the script does not fail anymore
!?

Could anyone help me understand what happens and how I could do to have a correct execution without hanging ?
Tell me if you require more elements

Thank you

Not sure about the exact error, but some general well-meant advice:

NEVER use your system python for a project (unless you EXACTLY know what you are doing).

Most operating systems use python somewhere. For this purpose it is available on the machine, and often exposed to the end user. However using it (and installing random packages) is a surefire way to break your system eventually, since you are manipulating an environment that really belongs to and is managed by your operating system.

Always create at least a virtual environment derived from your system Python. Or even create a fully separate root install using an installer from python.org, which you then derive a venv from.
If you do this for all your projects and applications you never run the risk of breaking some other applications assumptions about the libraries (and their versions) that you have installed.

But never run pip in your OS’ base environment (afaik pip will actually fail to do so in the future unless explicilty told to break your system :-P)

1 Like

Thanks for the advice.