【问题标题】:Docker - Micro service to expose ml model trained using fast.aiDocker - 微服务公开使用 fast.ai 训练的 ml 模型
【发布时间】:2019-01-15 10:42:37
【问题描述】:

我正在尝试构建一个 docker 来运行一个微服务,该微服务将公开使用 fast.ai 训练的 ml 模型

我正在使用的 Dockerfile

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 我正在使用

Flask==0.10.1
fastai==0.7.0

我收到以下错误:

    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/

有人知道我哪里错了吗?我是否必须使用其他基础映像?

【问题讨论】:

    标签: python docker pip


    【解决方案1】:

    是的,您需要使用另一个映像,该映像来自已安装大多数开发人员工具的操作系统。我创建了一个 Dockerfile,执行相同的安装,如下所示:

    FROM python:2.7.13
    
    COPY . .
    
    RUN pip install -r requirements.txt
    
    CMD ["python", "server.py"]
    

    要求:

    Flask==0.10.1
    fastai==0.7.0
    

    不同之处在于,Alpine 是一个较小的操作系统,具有少量代码库,因此他可能不包含所需的一切。

    参考:

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

    【讨论】:

    • 是的.. 我只需要使用 python 3.6 所以我将行从 python 2.7.13 替换为 FROM python 3.6 - 它可以工作
    • 太棒了!很高兴知道!你能标记为答案吗?人们会更容易找到它。
    猜你喜欢
    • 1970-01-01
    • 2017-12-31
    • 2019-04-19
    • 1970-01-01
    • 2017-08-19
    • 2017-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多