a year ago
hello,
I am developing a project that needs to use TA-Lib for Python, but when I install it, I get the following error:
Collecting ta-Lib
Downloading TA-Lib-0.4.28.tar.gz (357 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 357.1/357.1 kB 8.6 MB/s eta 0:00:00
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: numpy in /opt/venv/lib/python3.8/site-packages (from ta-Lib) (1.24.4)
Building wheels for collected packages: ta-Lib
Building wheel for ta-Lib (pyproject.toml): started
Building wheel for ta-Lib (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
│ exit code: 1
:77: UserWarning: Cannot find ta-lib library, installation may fail.
running bdist_wheel
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38/talib
copying talib/abstract.py -> build/lib.linux-x86_64-cpython-38/talib
copying talib/deprecated.py -> build/lib.linux-x86_64-cpython-38/talib
running build_ext
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/talib
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/jx3kvf6mk8qdaw30dbpngwmgm4p23xdb-libxcrypt-4.4.36/include -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-7x1xxemq/normal/lib/python3.8/site-packages/numpy/core/include -I/opt/venv/include -I/nix/store/7nghcnawd5b86kk0c0irfvq5gn2wbhbb-python3-3.8.18/include/python3.8 -c talib/_ta_lib.c -o build/temp.linux-x86_64-cpython-38/talib/_ta_lib.o
talib/_ta_lib.c:1082:10: fatal error: ta-lib/ta_defs.h: No such file or directory
1082 | #include "ta-lib/ta_defs.h"
compilation terminated.
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for ta-Lib
Failed to build ta-Lib
[notice] To update, run: pip install --upgrade pip
Please support me so I can install TA-Lib. Thank you!
4 Replies
Status changed to Solved railway[bot] • about 1 year ago
a year ago
You'll need to use a custom Dockerfile and install
ta-lib
from there.
I successfully built it thanks to this article https://www.answeroverflow.com/m/1095324587492917316
But my Django application is not launching yet :). I think the reason is that my application is not touching the startCommand
parameter in the railway.json
file:
"deploy": {
"startCommand": "python manage.py collectstatic --noinput && gunicorn mysite.wsgi --timeout 2000",
...
This is my Dockerfile content:
# Use an official Python runtime as a parent image
FROM python:3.8-slim-buster
# Install required packages
RUN apt-get update && \
apt-get install -y build-essential curl git && \
apt-get install -y libatlas-base-dev liblapack-dev libopenblas-dev gfortran && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install TA-Lib
RUN curl -L https://downloads.sourceforge.net/project/ta-lib/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz | tar xvz && \
cd ta-lib && \
./configure --prefix=/usr && \
make && \
make install && \
cd .. && \
rm -rf ta-lib
# install psycopg2 dependencies
RUN apt-get update \
&& apt-get -y install libpq-dev gcc \
&& pip install psycopg2
# Set the working directory to /app
WORKDIR /app
# Copy the requirements file into the container at /app
COPY ./requirements.txt /app/
# Install the required packages
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . /app/
ENTRYPOINT ["python", "manage.py", "makemigrations"]
ENTRYPOINT ["python", "manage.py", "migrate"]
# Expose port 8000 to allow external connections
# EXPOSE 8000
# Run the command to start the application
ENTRYPOINT ["python", "manage.py", "runserver"]
If you have any ideas for this, please share it with me. Thank you very much! :)
a year ago
the start command in the railway.json file should overwrite the ENTRYPOINT in your dockerfile, so please attach your deployment logs using this https://bookmarklets.up.railway.app/log-downloader/
a year ago
the start command in the railway.json file should overwrite the ENTRYPOINT in your dockerfile, so please attach your deployment logs using this https://bookmarklets.up.railway.app/log-downloader/
I found the answer from https://help.railway.app/questions/multiple-commands-on-start-command-won-t-e437ecee and I was successful in building and deploying my app. Thank you so much!