Error - Could not build wheels for spacy which use PEP 517 (deploying on Google App Engine)

Hi all,

I’m trying to deploy the bear classification model from Lesson 2 on Google App Engine and after running gcloud app deploy, ran into this error message:

ERROR: Could not build wheels for spacy which use PEP 517 and cannot be installed directly
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: exit status 1

Anyone else run into this before and know of a solution? I’m following the instructions in https://course.fast.ai/deployment_google_app_engine.html#per-project-setup and did try deploying locally first, which did work. For the model file, I’m using stage-2.pth (created from learn.save('stage-2')) instead of export.pkl.

Thanks!

1 Like

It seems to come from pip being unable to install spacy. Spacy is called by pip installing fastai.

This is a hotfix for the Dockerfile:

FROM python:3.6-slim-stretch

RUN apt update && apt install --no-install-recommends -y python3-dev gcc build-essential

ADD requirements.txt requirements.txt
RUN pip install --no-cache-dir spacy -r requirements.txt

COPY app app/

RUN python app/server.py

EXPOSE 8080

CMD ["python", "app/server.py", "serve"]

Note: Google Cloud deploy caps the docker deploys at 10min, and this is close to that, I do not know how to speed it up, but if it fails, try again…

I faced the exact same problem few hours ago. I added “spacy==2.1.6” in the requirements.txt file just before “fastai==1.0.55” and after that it worked. Note: These were the versions installed in my local environment so I used that.

You can increase the google deploy timeout with this command:

gcloud config set app/cloud_build_timeout 1000

1 Like