ImportError: libta_lib.so.0: cannot open shared object file: No such file or directory

Question:

i’m trying to import talib, but I’m getting this error:

ImportError: libta_lib.so.0: cannot open shared object file: No such file or directory

When I start python like this:

LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" python

import talib works.

How can I turn this solution into a fixed one?

Asked By: Filipe Ferminiano

||

Answers:

I had the same issue. See below for what I did to fix it.

installing

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
pip install numpy

If you don’t have it installed

pip install TA-Lib 

if you do have it installed

pip install --upgrade --force-reinstall TA-Lib

hope this helps someone 🙂

Answered By: Chris Evans

For me, following worked:

/usr/local/lib
  1. put above line to /etc/ld.so.conf
  2. execute sudo ldconfig.
Answered By: Yuki Inoue

add the foldername to ldconfig:

sudo -s 
echo "include /usr/local/lib" >> /etc/ld.so.conf
ldconfig 
Answered By: Alex

You may well find that ldconfig is already configured to search ‘/usr/local/lib’, and in this case, you only need to reload it, using sudo ldconfig.

(I would post this as a comment, but insufficient reputation.)

Answered By: Graeme

If you are arriving at this Stack Overflow question and you’re working with shared libraries that are being cross compiled for different platforms/architectures, consider that you might be trying to access a shared object that was compiled for another platform by mistake.

I was getting this error while building my own shared libraries on a darwin/arm64 system for a linux/amd64 docker container. After rebuilding my shared libraries while being careful to build for the right architecture, I no longer received the cannot open shared object file: No such file or directory error and my shared library was accessible to my python application.

Answered By: Joshua Schlichting
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.