Here is the error that I'm getting when I try to install Ta-Lib in Cloud Run using a Dockerfile
error: subprocess-exited-with-error
× Building wheel for ta-lib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
<string>:77: UserWarning: Cannot find ta-lib library, installation may fail.
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/talib
copying talib/test_polars.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/test_pandas.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/__init__.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/test_stream.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/stream.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/abstract.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/test_func.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/test_abstract.py -> build/lib.linux-x86_64-cpython-310/talib
copying talib/test_data.py -> build/lib.linux-x86_64-cpython-310/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/talib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/ta-lib/include -I/tmp/pip-build-env-yj8q5fu_/normal/lib/python3.10/site-packages/numpy/core/include -I/usr/local/include/python3.10 -c talib/_ta_lib.c -o build/temp.linux-x86_64-cpython-310/talib/_ta_lib.o
talib/_ta_lib.c:747:10: fatal error: ta-lib/ta_defs.h: No such file or directory
747 | #include "ta-lib/ta_defs.h"
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for ta-lib
Successfully built websocket
Failed to build ta-lib
ERROR: Could not build wheels for ta-lib, which is required to install pyproject.toml-based projects
[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: pip install --upgrade pip
The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt' returned a non-zero code: 1
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BUILD FAILURE: Build step failure: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
ERROR: (gcloud.builds.submit) build 8c54cd65-f189-476a-8bd9-f7fe7b428bfe completed with status "FAILURE"
My requirements.txt file looks like this:
Flask==2.1.0
gunicorn==20.1.0
websocket
pandas
numpy
ta-lib
And my Dockerfile looks like this:
FROM python:3.10-slim
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
WORKDIR /var/www/html
COPY . /var/www/html/
# Install production dependencies.
RUN pip install --no-cache-dir -r requirements.txt
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
Has anyone been able to install Python package Ta-Lib using Dockerfile? I've been breaking my head over the wall to make it work but it won't.