How to fix Dockerfile numba install error: ERROR: Dependency OpenBLAS not found

Problem

During a Docker build, you encounter the following error while installing the numba package using pip install numba or similar:

openblas_dependency_error.txt
../scipy/meson.build:216:9: ERROR: Dependency "OpenBLAS" not found, tried pkgconfig

Solution

You need to install the gfortran package in the container:

install_openblas.sh
sudo apt -y install libopenblas-dev

Add the following line to your Dockerfile (for deb-based distributions):

Dockerfile_add_openblas
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y gfortran libopenblas-dev && rm -rf /var/lib/apt/lists/*

gfortran-dev is required in addition to gfortran to build numba.


Check out similar posts by category: Python, Docker