openfaas / python-flask-template

HTTP and Flask-based OpenFaaS templates for Python 3
MIT License
85 stars 85 forks source link

Support for numpy #28

Closed Anderssorby closed 4 years ago

Anderssorby commented 4 years ago

It is rather difficult to get numpy support since it requires it to be compiled inside the docker image. Adding numpy to the requirements.txt for these alpine images causes an error like:

ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-xjbzgbxn/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.13' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version>='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' Check the logs for full command output.

Could you provide a build option like (not sure if all packages are necessary):

  - name: numpy
    packages:
      - gcc
      - gfortran
      - python
      - python-dev
      - py-pip
      - build-base
      - py3-numpy
      - wget
      - freetype-dev
      - libpng-dev
      - openblas-dev
alexellis commented 4 years ago

Hi @Anderssorby I don't believe you have the right mix of packages there.

However this is a moot point because for numpy we do not recommend Alpine Linux.

You can use the python3-debian template to get numpy, or wait for #26 to be merged and then use that if you need the http-style template.

Alex