Certain packages can be troublesome to install in a Docker container when they’re defined in a requirements.txt file, such as scipy. If you’re running into issues installing these, which are typically problems with installing or building dependencies, try running pip install from the Dockerfile itself, then installing from requirements.txt.

Example#

RUN pip install --no-cache-dir --upgrade pip && \  
    pip install numpy scipy cython && \  
    pip install -r requirements.txt --target ${FUNCTION_DIR}