【问题标题】:How to install package in Dockerfile by using Python -m pip install如何使用 Python -m pip install 在 Dockerfile 中安装包
【发布时间】:2022-12-15 17:48:45
【问题描述】:

我正在从官方 git repo 安装 Onnxruntime-extensions,但在 Dockerfile 中失败:

这些包还没有准备好,所以它可以从源代码安装。请确保在执行以下命令之前安装了 gcc(高于 g++ 8.0)或 clang 等编译器工具包,以及工具 cmake

python -m pip install git+https://github.com/microsoft/onnxruntime-extensions.git

文件

  • 这不起作用。

运行 python -m pip install git+https://github.com/microsoft/onnxruntime-extensions.git


    FROM ubuntu:20.04
    ENV TZ=continent/capital
    
    RUN apt-get update && apt-get install software-properties-common -y &&\
    add-apt-repository -y ppa:deadsnakes/ppa && \
    apt-get update && \
    apt-get install -y libopencv-dev && \
    apt-get install -y git && \
    apt-get install -yq tzdata &&\
    ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
    
    RUN apt-get install -y python3.7 python3-pip python3.7-dev libc-dev build-essential zlib1g-dev libxml2-dev libxslt1-dev antiword unrtf poppler-utils >
    flac ffmpeg lame libmad0 libsox-fmt-mp3 sox libjpeg-dev swig
    RUN apt-get install -y gunicorn
    
    #set the working directory
    WORKDIR /project
    
    #copy requriment file to docker set directory
    COPY ./requirements.txt  /project
    
    #install dependencies for onnx
    RUN apt install -y libprotobuf-dev protobuf-compiler
    
    
    
    #WORKDIR /project/build
    RUN apt-get update && apt-get -y install cmake
    
    
    #installing requirements txt file
    RUN pip install --no-cache-dir --upgrade -r requirements.txt
    
    # installing onnxrunttime-extensions   --------Problem is here-------
    RUN python -m  pip install git+https://github.com/microsoft/onnxruntime-extensions.git
    
    RUN pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.4.0/en_core_web_lg-3.4.0-py3-none-any.whl
    
    # copy the scripts and all to the set directory
    COPY . /project
    
    # start the server
    CMD ["gunicorn"  , "-b", "0.0.0.0:8000", "wsgi:app", "--workers=33", "--timeout=28800"]

错误


    => ERROR [docker-project 10/12] RUN python -m  pip install git+https://github.com/microsoft/onnxruntime-extensions.git  
    
    > [docker-project 10/12] RUN python -m  pip install git+https://github.com/microsoft/onnxruntime-extensions.git:
    #0 0.284 /bin/sh: 1: python: not found
    ------
    failed to solve: executor failed running [/bin/sh -c python -m  pip install git+https://github.com/microsoft/onnxruntime-extensions.git]: exit code: 127

任何帮助将不胜感激,请看一看,请不要忽略。

【问题讨论】:

    标签: python docker ubuntu dockerfile containers


    【解决方案1】:

    也许使用 python3 而不是 python

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-21
      • 1970-01-01
      • 2018-06-24
      • 2015-08-17
      • 1970-01-01
      • 2016-04-15
      • 1970-01-01
      相关资源
      最近更新 更多