1

I can successfully install the ta-lib in google colab as follow:

import os, sys 
from google.colab import drive 
drive.mount('/content/gdrive') 
nb_path = '/content/notebooks'
os.symlink('/content/gdrive/My Drive/Colab Notebooks', nb_path)
sys.path.insert(0, nb_path)  # or append(nb_path)

!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar xvf ta-lib-0.4.0-src.tar.gz
!ls {nb_path}
!cd {nb_path}/ta-lib && ./configure --prefix=/usr
!cd {nb_path}/ta-lib && make
!cd {nb_path}/ta-lib && sudo make install
!pip install --target=$nb_path numpy
!cd {nb_path}/ta-lib && pip install --target=$nb_path --upgrade --force-reinstall TA-Lib

!wget -P {nb_path} https://files.pythonhosted.org/packages/90/05/d4c6a778d7a7de0be366bc4a850b4ffaeac2abad927f95fa8ba6f355a082/TA-Lib-0.4.17.tar.gz
!cd {nb_path} && tar xvf TA-Lib-0.4.17.tar.gz
!cd '/content/gdrive/My Drive/Colab Notebooks/TA-Lib-0.4.17' && python setup.py install

import talib

I restart the notebook the second time as follow:

from google.colab import drive
drive.mount('/content/gdrive')
import  os, sys
nb_path = '/content/notebooks'
os.symlink('/content/gdrive/My Drive/Colab Notebooks', nb_path)
sys.path.append(nb_path)

import talib

But I got error as follow:

ImportError     Traceback (most recent call last)
<ipython-input-9-1ee486ccef90> in <module>
----> 1 import talib

/content/notebooks/talib/__init__.py in <module>
     91 
     92 
---> 93 from ._ta_lib import (
     94     _ta_initialize, _ta_shutdown, MA_Type, __ta_version__,
     95     _ta_set_unstable_period as set_unstable_period,

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

I have to reinstall the talib as by the first time. This is surely not what I want.

thomas2004ch
  • 367
  • 1
  • 4
  • 10

0 Answers0