R
Railway16mo ago
Lee1000

Does anyone know how to install ta-lib?

I tried to install ta-lib, but I got the following: #11 31.59 Building wheels for collected packages: TA-Lib #11 31.59 Building wheel for TA-Lib (pyproject.toml): started #11 32.74 Building wheel for TA-Lib (pyproject.toml): finished with status 'error' #11 32.75 Failed to build TA-Lib #11 32.75 error: subprocess-exited-with-error #11 32.75 #11 32.75 × Building wheel for TA-Lib (pyproject.toml) did not run successfully. #11 32.75 │ exit code: 1 #11 32.75 ╰─> [27 lines of output] #11 32.75 <string>:77: UserWarning: Cannot find ta-lib library, installation may fail. #11 32.75 ERROR: Failed building wheel for TA-Lib #11 32.75 ERROR: Could not build wheels for TA-Lib, which is required to install pyproject.toml-based projects My project ID is ad7c9bbc-1aa3-40e0-ba84-511487698898
7 Replies
Percy
Percy16mo ago
Project ID: ad7c9bbc-1aa3-40e0-ba84-511487698898
Percy
Percy16mo ago
You might find these helpful: - How do I install ta-lib?
⚠️ experimental feature
Brody
Brody16mo ago
you'd need to use a dockerfile for this usecase, and there are plenty of sample dockerfiles for installing ta-lib and running a python project
Lee1000
Lee100016mo ago
Great, thank you, successfully installed!
Brody
Brody16mo ago
and maybe for anyone else that might see this thread and have the same issue, do you think you could post your dockerfile?
Lee1000
Lee100016mo ago
Sure! Here you go:
# Use an official Python runtime as a parent image
FROM python:3.9-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

# Set the working directory to /app
WORKDIR /app

# Copy the requirements file into the container at /app
COPY requirements.txt .

# Install the required packages
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container at /app
COPY . .

# Run the command to start the application
CMD ["python", "main.py"]
# Use an official Python runtime as a parent image
FROM python:3.9-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

# Set the working directory to /app
WORKDIR /app

# Copy the requirements file into the container at /app
COPY requirements.txt .

# Install the required packages
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container at /app
COPY . .

# Run the command to start the application
CMD ["python", "main.py"]
@matifali done!
Brody
Brody16mo ago
thank you! that will be of great help to anyone in the future!