0

we are trying to host tensorflow object-detection model on GCP. we have maintain below directory structure before running "gcloud app deploy". For you convenient I am attaching the configuration files with the question. Wer are getting deployment error which is mentioned below. Please suggest a solution.

  • +root
    • +object_detection/
    • +slim/
    • +env
    • +app.yaml
    • +Dockerfile
    • +requirement.txt
    • +index.html
    • +test.py

Dockerfile



    FROM gcr.io/google-appengine/python
    LABEL python_version=python2.7
    RUN virtualenv --no-download /env -p python2.7

    # Set virtualenv environment variables. This is equivalent to running
    # source /env/bin/activate
    ENV VIRTUAL_ENV /env
    ENV PATH /env/bin:$PATH

    # Various Python and C/build deps
    RUN apt-get update && apt-get install -y \ 
        wget \
        build-essential \ 
        cmake \ 
        git \
        unzip \ 
        pkg-config \
        python-dev \ 
        python-opencv \ 
        libopencv-dev \ 
        libav-tools  \ 
        libjpeg-dev \ 
        libpng-dev \ 
        libtiff-dev \ 
        libjasper-dev \ 
        libgtk2.0-dev \ 
        python-numpy \ 
        python-pycurl \ 
        libatlas-base-dev \
        gfortran \
        webp \ 
        python-opencv \ 
        qt5-default \
        libvtk6-dev \ 
        zlib1g-dev \
        protobuf-compiler \
        python-pil python-lxml \
        python-tk


    # Install Open CV - Warning, this takes absolutely forever

    ADD requirements.txt /app/
    RUN pip install -r requirements.txt
    ADD . /app/
    RUN protoc /app/object_detection/protos/*.proto --python_out=/app/.
    RUN export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/app/slim
    CMD exec gunicorn -b :$PORT UploadTest:app


requirement.txt



    Flask==0.12.2
    gunicorn==19.7.1
    numpy==1.13.1
    requests==0.11.1
    bs4==0.0.1
    nltk==3.2.1
    pymysql==0.7.2
    xlsxwriter==0.8.5
    Pillow==4.2.1
    pytesseract==0.1
    opencv-python>=3.0
    matplotlib==2.0.2
    tensorflow==1.3.0
    lxml==4.0.0


app.yaml



    runtime: custom
    env: flex
    entrypoint: gunicorn -b :$PORT UploadTest:app
    threadsafe: true
    runtime_config:
      python_version: 2


After all this i am seeting up the google cloud environment with gcloud init And then start command gcloud app deploy

I am getting below error while deploying the solution.

Error:



    Step 10/12 : RUN protoc /app/object_detection/protos/*.proto    --python_out=/app/.
    ---> Running in 9b3ec9c43c2d
    /app/object_detection/protos/anchor_generator.proto: File does not reside  within any path specified using --proto_path (or -I).  You must specify a   --proto_path which encompasses this file.  Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).
    The command '/bin/sh -c protoc /app/object_detection/protos/*.proto --python_out=/app/.' returned a non-zero code: 1
    ERROR
    ERROR: build step "gcr.io/cloud-builders/docker@sha256:a4a83be9b2fb61452e864ecf1bcfca99d1845499ef9500ae2905cea0ea593769" failed: exit status 1

    ----------------------------------------------------------------------------------------------------------------------------------------------

    ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/gcr/builds/4dba3217-b7d6-4341-b28e-09a9dad45c18?

There is a directory "object_detection/protos" present and all necessary files are present there. Still getting deployment error. Please suggest where to change in dockerfile to deploy it successfully.

My assumption: GCP is not able to figure out the path of the protc file. May be I have to alter something in Docketfile. But not able to figure out the solution. Please answer.

NB: This setup is running well in local machine. But not working in GCP

Aniruddha
  • 26
  • 5
  • When you say this setup works well in local machine. Do you mean with your dockerfile or on your host? – Tarun Lalwani Oct 04 '17 at 13:03
  • Without dockerfile. On my host machine only. – Aniruddha Oct 04 '17 at 14:07
  • Then you should first testing building your Dockerfile locally and then talk about pushing to google – Tarun Lalwani Oct 04 '17 at 14:09
  • I am very new to Dockerfile concept. I am struggling to build Dockerfile with protoc. "RUN protoc /app/object_detection/protos/*.proto --python_out=/app/." this command is throwing deployment error.. Any suggestion? – Aniruddha Oct 05 '17 at 06:09
  • Try changing `RUN protoc /app/object_detection/protos/*.proto --python_out=/app/. --proto_path=/app/object_detection/protos/`, see if that helps – Tarun Lalwani Oct 05 '17 at 06:20
  • I have tried, but no luck. I have changed the path accordingly but same error persist."ADD object_detection /app/object_detection RUN pip install -r requirements.txt RUN protoc /app/object_detection/protos/*.proto --python_out=. --proto_path=/app/object_detection/protos/ RUN export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/app/slim ADD . /app/" – Aniruddha Oct 07 '17 at 08:51

0 Answers0