aistreamer icon indicating copy to clipboard operation
aistreamer copied to clipboard

Docker Build Failing with SyntaxError in grpcio Installation (Despite Python Version and pip fixes)

Open Jorgeemu opened this issue 1 year ago • 0 comments

I am trying to build the Docker image for the AIStreamer ingestion library according to the repository instructions. However, I am encountering a SyntaxError during the installation of the grpcio package, even after addressing potential issues with pip and the Python version.

Steps to Reproduce:

Clone the aistreamer repository: git clone https://github.com/google/aistreamer.git Navigate to the ingestion directory: cd aistreamer/ingestion Set the DOCKER_IMAGE environment variable: export DOCKER_IMAGE=gcr.io//aistreamer-image:v1.0.0 Modify env/Dockerfile: Replace line 80: Dockerfile RUN easy_install pip

With: Dockerfile RUN apt-get update &&
apt-get install -y python3-pip

Update line 136: Dockerfile RUN pip install --upgrade google-cloud-videointelligence

With: Dockerfile RUN python3 -m pip install --upgrade google-cloud-videointelligence

Update line 137: Dockerfile RUN pip install --user psutil

With: Dockerfile RUN python3 -m pip install --user psutil

Change the base image (line 1): Dockerfile FROM ubuntu:bionic

Build the Docker image: docker build -t $DOCKER_IMAGE -f env/Dockerfile .

Error Message:

... File "/tmp/pip-build-9x9fil1a/grpcio/setup.py", line 109 f"Programming Language :: Python :: {x}" ^ SyntaxError: invalid syntax ... Environment:

Google Cloud Shell Docker (latest version) Attempted Solutions:

Replaced easy_install pip with apt-get install -y python3-pip to install pip. Used python3 -m pip to explicitly invoke pip with the correct Python interpreter. Updated the base image from ubuntu:xenial to ubuntu:bionic to use Python 3.6. Additional Information:

The error peImage rsists even after making the above changes to address potential issues with pip and the Python version. It seems to be related to the use of f-strings in the grpcio package, but the exact cause remains unclear.

Request:

Could you please investigate this further and provide a solution to successfully build the Docker image? I have included all the modifications I made to the Dockerfile.

Jorgeemu avatar Nov 25 '24 23:11 Jorgeemu