pythonnumbajitraspberry-pi-zero

Weird behavior while using numba on a raspberry pi zero


I got some weird behavior while using numba on a raspberry pi zero. When I use floating numbers, my function returns weird calculations which are mathematically wrong. This is my code:

import numba

@numba.jit(nopython=True)
def numtesting(n):
    print(n)
    print(n)


numtesting(1.0)

I would expect

Instead i get:

Any ideas what's happening?


Solution

  • I gave up installing numba on my Raspberry Pi Zero. Found infos on github that numba only correctly works on 64-bit architectures. However, I bought myself a Raspberry Pi Zero 2 with 64-bit architecture and I managed to install numba 0.56.4 on it. However, I had to use some workarounds, here is how i did it:

    OS: Raspberry Pi OS Lite (32bit) For llvmlite to be installed successfully, I installed sudo apt install -y llvm-dev libffi-dev For numpy to run successfully, I installed sudo apt-get install -y libatlas libopenjp2-7 After that i used pip install llvmlite==0.39.1 into a virtual environment At this point I faced the issue, that the installer froze builing a wheel for llvmlite. ChatGPT helped by recommending to increase the SWAP size in /etc/dphys-swapfile to 1024 (Default was 100). The parameter is called CONF_SWAPSIZE

    After that i was able to install numpy into my virtual environment using pip install numpy==0.56.4 I really hope it helps someone. I took me quite some time to figure this out...