This has always been a tricky one, but I had made a script that has served me loyally in several Ubuntu physical, VM, and server instances (including GitHub Actions).
It's a little long but it's comprehensive and has worked in every Ubuntu instance I've needed it for. It includes a few precautionary steps that have previously caused errors.
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
sudo apt install wget -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get install build-essential -y
sudo apt install python3.10-dev -y
sudo apt-get install python3-dev -y
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
wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O './config.guess'
wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O './config.sub'
./configure --prefix=/usr
make
sudo make install
sudo rm -rf ta-lib
sudo rm -rf ta-lib-0.4.0-src.tar.gz
pip install ta-lib
It consists of many steps...
- Update built-in packages using apt.
- Add the deadsnakes repo.
- Install
build-essential
and python-dev
(python3-dev
, python3.10-dev
).
- Download the TA-Lib tarball with
wget
.
- Download the updated make recognizer files to prevent common issues with
make
and make install
.
make
TA-Lib and make install
it.
- Clean up the mess.
- Install with
pip
to make sure everything worked out. (pip
will install the latest version of TA-Lib, 0.4.24
, even though we can only download the source for 0.4.0
. This works fine.)
Because I use this frequently, I turned it into a gist, for the purpose of accessing the script directly with curl
.
Just grab a raw link from the Gist page and use it like below.
curl https://gist.githubusercontent.com/preritdas/bunchofrandomstuffhere/install-talib-ubuntu.sh | sudo bash
Make sure you're sudo
activated before running the command to prevent issues. It will run all the above commands as a script and install TA-Lib in about 4-5 minutes (average, in my experience).
Here's a shell recording of this working on a fresh server instance of Ubuntu 22.04.

All in all, I hope this helps; for me, it made a once frustrating and volatile process easy.