unable to import TA-Lib - Python

Sociopath picture Sociopath · Mar 15, 2018 · Viewed 9.9k times · Source

I am trying to importTA-Lib in python but getting an error:

Traceback (most recent call last): File "", line 1, in File "/home/arque/anaconda3/lib/python3.6/site-packages/talib/init.py", >line 43, in from ._ta_lib import ( ModuleNotFoundError: No module named 'talib._ta_lib'

Steps that I follow to install:

1. wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
2. tar -xzf ta-lib-0.4.0-src.tar.gz
3. cd ta-lib/
4. ./configure --prefix=/usr
5. make
6. sudo make install
7. pip install TA-Lib

TA-Lib successfully installed but when I'm trying to import the same, getting the error mentioned above.

Also tried the solutions given here but didn't work.

Using Linux Ubuntu 32bit and python 3.6

Any help and suggestions are welcome.

Answer

Baz picture Baz · Oct 28, 2018

This is the process I used to fix the problem when I got this error - however I'm using a 64-bit Windows installation, so you'll need to make some changes along the way!

  • Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib and download the relevant *.whl file (depending on which python version you’re using, and depending on whether you have a 32 bit or 64 bit operating system)
  • Copy the whl file into the C:\Users\your_name directory
  • Go to Anaconda and click on the Environments tab and open the Terminal window (from the Base(root) environment arrow)
  • In the Terminal window type “conda list” to see if TA-Lib is already available and continue if not
  • Type “conda update conda” to ensure you have the latest version installed
  • You’ll install TA-Lib using pip so ensure you have the latest version of pip by typing “python -m pip install --upgrade pip”
  • Then install the TA-Lib package by typing “pip install TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl” (or whatever the name of your *.whl file is)
  • Check to see that it’s installed by typing “conda list” and finding it on the list

Hope this helps :)