I am kinda new to gcloud and I don't know how to fix this error :(

When I try to deploy my API to Cloud run I get this error message:

Failed to build the app. Error: unable to stream build output: The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 1 

this is the detailed logs:

[0m
[91mWARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
[0m
unable to stream build output: The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 1
Failed to build the app. Error: unable to stream build output: The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 1

this is what I'm trying to import in the 1st file (snsr.py):

import requests
import numpy
import time
from time import sleep
import re
import random 
import math
import hashlib
from urllib.parse import unquote

this is what I'm trying to import in the 2nd file (main.py):

from flask import Flask, jsonify, request
import snsr
import os 
import binascii
import hashlib

this is my requirements.txt file:

Flask==2.0.2
gunicorn==20.1.0
requests
numpy
regex
python-math
urllib3
os-win

this is my docker:

# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.10-slim

# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True

# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./

# Install production dependencies.
RUN pip install -r requirements.txt

# Run the web service on container startup. Here we use the gunicorn
# webserver, with one worker process and 8 threads.
# For environments with multiple CPU cores, increase the number of workers
# to be equal to the cores available.
# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
0

There are 0 best solutions below