Issues installing TA-Lib on Ubuntu 22.04 (Python 3.10.12)

Title:

TA-Lib Installation Issues on Ubuntu 22.04 (Python 3.10.12)

Body:

Hello everyone,

I’m trying to install TA-Lib on Ubuntu 22.04, but I’m facing multiple errors during the installation process.

System Information:

  • OS: Ubuntu 22.04
  • Python version: 3.10.12
  • Pip version: 25.0.1
  • GCC version: 11.4.0
  • Virtual Environment: No (running as root)

What I’ve Tried:

First, I ensured all required dependencies are installed:

bash

CopyEdit

sudo apt update && sudo apt upgrade -y
sudo apt install build-essential libssl-dev libffi-dev libxml2-dev libxslt-dev zlib1g-dev

Then, I attempted to install TA-Lib using pip:

bash

CopyEdit

pip install TA-Lib

or via manual installation from source:

bash

CopyEdit

wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib
./configure --prefix=/usr
make
sudo make install

However, I consistently receive the following error:

bash

CopyEdit

ERROR: Failed building wheel for TA-Lib
ERROR: Could not build wheels for TA-Lib, which is required to install pyproject.toml-based projects

Additionally, when I check if TA-Lib is installed, I get this error:

bash

CopyEdit

python3 -c "import talib; print(talib.get_functions())"
ModuleNotFoundError: No module named 'talib'

Question:

  • What could be causing this issue?
  • Are there any additional dependencies I need to install?
  • Is there a recommended way to install TA-Lib on Ubuntu 22.04?

Any help would be greatly appreciated! Thanks in advance.

ta-lib is a library written in C. It’s not a python module and can’t be loaded into python directly. You need a python wrapper around ta-lib. By “import talib” you are trying to find and load such wrapper. The python wrapper is another project and hosted here: GitHub - TA-Lib/ta-lib-python: Python wrapper for TA-Lib (http://ta-lib.org/).
It could be build on machine or installed with help of “pip install ta-lib”. So you should have both - c library and python wrapper for it on machine.