简体   繁体   中英

Docker - Micro service to expose ml model trained using fast.ai

I am trying to build a docker to run a microservice which will expose the ml model trained using fast.ai

Dockerfile I am using

FROM python:3.6-alpine

MAINTAINER Spandan Singh "developer.spandan@gmail.com"

COPY ./app/requirements.txt /app/requirements.txt

WORKDIR /app

RUN pip install -r requirements.txt

COPY . /app

CMD ["python", "server.py"]

requirements.txt I am using

Flask==0.10.1
fastai==0.7.0

I am getting the following error:

    Collecting pandas (from fastai->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/e9/ad/5e92ba493eff96055a23b0a1323a9a803af71ec859ae3243ced86fcbd0a4/pandas-0.23.4.tar.gz (10.5MB)
    Complete output from command python setup.py egg_info:
    /bin/sh: svnversion: not found
    non-existing path in 'numpy/distutils': 'site.cfg'
    Could not locate executable gfortran
    Could not locate executable f95
    Could not locate executable ifort
    Could not locate executable ifc
    Could not locate executable lf95
    Could not locate executable pgfortran
    Could not locate executable f90
    Could not locate executable f77
    Could not locate executable fort
    Could not locate executable efort
    Could not locate executable efc
    Could not locate executable g77
    Could not locate executable g95
    Could not locate executable pathf95
    Could not locate executable nagfor
    don't know how to compile Fortran code on platform 'posix'
    Running from numpy source directory.
    /tmp/easy_install-t7xbqniu/numpy-1.16.0/setup.py:390: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    /tmp/easy_install-t7xbqniu/numpy-1.16.0/numpy/distutils/system_info.py:625: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 163, in run
        self.run_command("egg_info")  
    RuntimeError: Broken toolchain: cannot link a simple C program

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-vuh6917n/pandas/

Does anyone know where I am wrong? Should I have to use some another base image?

Yes, you need to use another image, from operating system that already contains most developer tools installed. I've created a Dockerfile doing the same installation as follows:

FROM python:2.7.13

COPY . .

RUN pip install -r requirements.txt

CMD ["python", "server.py"]

requirements:

Flask==0.10.1
fastai==0.7.0

The difference seems that Alpine is a smaller OS with a light-code base, so it might be possible that he does not contain everything needed.

Reference:

https://github.com/nengo/nengo/issues/508

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM