Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install TA-lib in google colab?

I'm trying to install TA-Lib package in google colab notebook but without success. I tried this guide and also Installing TA-Lib on python x64

I get this error:

import platform
print (platform.architecture())

import sys
print(sys.version)

!pip install C:/ta-lib/TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl

#########
('64bit', '')
3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0]
 Requirement 'C:/ta-lib/TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl' looks like a 
  filename, but the file does not exist
  TA_Lib-0.4.17-cp36-cp36m-win_amd64.whl is not a supported wheel on this 
  platform.
like image 468
OriD Avatar asked Apr 04 '18 10:04

OriD


People also ask

How do I install TA-Lib?

To install Ta-Lib, you will first install Anaconda and then open the Anaconda prompt. You would then write the code, “conda install -c conda-forge ta-lib”, and press the “Enter” key. After a few moments, the ta-lib package will be installed. That's all there is to it.

What libraries are installed in Google Colab?

Colab environment comes with a number of pre-installed scientific and machine learning packages such as numpy, scipy, pandas, tensorflow, and pytorch.

How do I import to Colab?

From Github It is the easiest way to upload a CSV file in Colab. For this go to the dataset in your GitHub repository, and then click on “View Raw”. Copy the link to the raw dataset and pass it as a parameter to the read_csv() in pandas to get the dataframe.


1 Answers

Have you tried following instructions from here?

https://github.com/mrjbq7/ta-lib

And change any sudo apt-get to just !apt. Any cd to %cd

Update: try this

!wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
!tar -xzvf ta-lib-0.4.0-src.tar.gz
%cd ta-lib
!./configure --prefix=/usr
!make
!make install
!pip install Ta-Lib
import talib

Update(may 2020): for binary install (no compile)

url = 'https://launchpad.net/~mario-mariomedina/+archive/ubuntu/talib/+files'
ext = '0.4.0-oneiric1_amd64.deb -qO'
!wget $url/libta-lib0_$ext libta.deb
!wget $url/ta-lib0-dev_$ext ta.deb
!dpkg -i libta.deb ta.deb
!pip install ta-lib
import talib

Update(may 2021): even faster

url = 'https://anaconda.org/conda-forge/libta-lib/0.4.0/download/linux-64/libta-lib-0.4.0-h516909a_0.tar.bz2'
!curl -L $url | tar xj -C /usr/lib/x86_64-linux-gnu/ lib --strip-components=1
url = 'https://anaconda.org/conda-forge/ta-lib/0.4.19/download/linux-64/ta-lib-0.4.19-py37ha21ca33_2.tar.bz2'
!curl -L $url | tar xj -C /usr/local/lib/python3.7/dist-packages/ lib/python3.7/site-packages/talib --strip-components=3
import talib

Update (dec 2021): from @roborative, this is easiest to remember and take 3.8s (above is 1.2s)

!pip install talib-binary
like image 138
korakot Avatar answered Sep 19 '22 11:09

korakot