Forums

glenn, help me install ta-lib!

I'm using the command "pip install TA-lib --user". It shows some lines indicating that it's being installed, but then it stops at one line. It keeps waiting for hours and eventually throws an error. Below, I'm sharing the code lines:

09:38 ~ $ pip install TA-lib --user Looking in links: /usr/share/pip-wheels Collecting TA-lib Using cached ta_lib-0.6.3.tar.gz (376 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: setuptools in /usr/local/lib/python3.10/site-packages (from TA-lib) (60.2.0) Requirement already satisfied: numpy in /usr/local/lib/python3.10/site-packages (from TA-lib) (1.21.6) Building wheels for collected packages: TA-lib Building wheel for TA-lib (pyproject.toml) ... |

You appear to have not included the error message.

Hi, I have same issue. I cannot install talib and I also checked the installed batteries and iot is is not included. Please help me since my Python ius based on TA-lib.

What command did you run and what error message do you see?

I also have problems with installing ta-lib:

  • command used: pip install --user ta-lib

error received:

  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpbxhkfn0p
       cwd: /tmp/pip-install-notoiojh/ta-lib_e4d63942f2c04f26a40cfa628185172d
  Complete output (71 lines):
  <string>:83: UserWarning: Cannot find ta-lib library, installation may fail.
  /tmp/pip-build-env-jblfzcib/overlay/lib/python3.9/site-packages/setuptools/config/_apply_pyprojecttoml.py:81: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
    corresp(dist, value, root_dir)
  running bdist_wheel
  running build
  running build_py
  creating build/lib.linux-x86_64-cpython-39/talib
  copying talib/abstract.py -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/deprecated.py -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/stream.py -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/__init__.py -> build/lib.linux-x86_64-cpython-39/talib
  running egg_info
  writing ta_lib.egg-info/PKG-INFO
  writing dependency_links to ta_lib.egg-info/dependency_links.txt
  writing requirements to ta_lib.egg-info/requires.txt
  writing top-level names to ta_lib.egg-info/top_level.txt
  reading manifest file 'ta_lib.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'LICENSE'
  adding license file 'AUTHORS'
  writing manifest file 'ta_lib.egg-info/SOURCES.txt'
  copying talib/_abstract.pxi -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/_common.pxi -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/_func.pxi -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/_stream.pxi -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/_ta_lib.c -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/_ta_lib.pyi -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/_ta_lib.pyx -> build/lib.linux-x86_64-cpython-39/talib
  copying talib/py.typed -> build/lib.linux-x86_64-cpython-39/talib
  running build_ext
  building 'talib._ta_lib' extension
  creating build/temp.linux-x86_64-cpython-39/talib
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/opt/homebrew/include -I/opt/homebrew/opt/ta-lib/include -I/tmp/pip-build-env-jblfzcib/normal/lib/python3.9/site-packages/numpy/_core/include -I/usr/local/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-x86_64-cpython-39/talib/_ta_lib.o
  In file included from /tmp/pip-build-env-jblfzcib/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/ndarraytypes.h:1909,
                   from /tmp/pip-build-env-jblfzcib/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/ndarrayobject.h:12,
                   from /tmp/pip-build-env-jblfzcib/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/arrayobject.h:5,
                   from talib/_ta_lib.c:1235:
  /tmp/pip-build-env-jblfzcib/normal/lib/python3.9/site-packages/numpy/_core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     17 | #warning "Using deprecated NumPy API, disable it with " \
        |  ^~~~~~~
  talib/_ta_lib.c: In function ‘__pyx_pf_5talib_7_ta_lib_18ACCBANDS’:
  talib/_ta_lib.c:13234:40: warning: implicit declaration of function ‘TA_ACCBANDS_Lookback’; did you mean ‘TA_BBANDS_Lookback’? [-Wimplicit-function-declaration]
  13234 |   __pyx_v_lookback = (__pyx_v_begidx + TA_ACCBANDS_Lookback(__pyx_v_timeperiod));
        |                                        ^~~~~~~~~~~~~~~~~~~~
        |                                        TA_BBANDS_Lookback
  talib/_ta_lib.c:13251:21: warning: implicit declaration of function ‘TA_ACCBANDS’; did you mean ‘TA_S_BBANDS’? [-Wimplicit-function-declaration]
  13251 |   __pyx_v_retCode = TA_ACCBANDS(0, __pyx_v_endidx, (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_high)) + __pyx_v_begidx), (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_low)) + __pyx_v_begidx), (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_close)) + __pyx_v_begidx), __pyx_v_timeperiod, (&__pyx_v_outbegidx), (&__pyx_v_outnbelement), (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_outrealupperband)) + __pyx_v_lookback), (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_outrealmiddleband)) + __pyx_v_lookback), (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_outreallowerband)) + __pyx_v_lookback));
        |                     ^~~~~~~~~~~
egidx), __pyx_v_timeperiod, (&__pyx_v_outbegidx), (&__pyx_v_outnbelement), (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_outrealupperband))
        |                     TA_S_BBANDS
  talib/_ta_lib.c: In function ‘__pyx_pf_5talib_7_ta_lib_46AVGDEV’:
  talib/_ta_lib.c:16233:40: warning: implicit declaration of function ‘TA_AVGDEV_Lookback’; did you mean ‘TA_STDDEV_Lookback’? [-Wimplicit-function-
declaration]
  16233 |   __pyx_v_lookback = (__pyx_v_begidx + TA_AVGDEV_Lookback(__pyx_v_timeperiod));
        |                                        ^~~~~~~~~~~~~~~~~~
        |                                        TA_STDDEV_Lookback
  talib/_ta_lib.c:16240:21: warning: implicit declaration of function ‘TA_AVGDEV’; did you mean ‘TA_STDDEV’? [-Wimplicit-function-declaration]
  16240 |   __pyx_v_retCode = TA_AVGDEV(0, __pyx_v_endidx, (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_real)) + __pyx_v_begidx), __pyx_v_
timeperiod, (&__pyx_v_outbegidx), (&__pyx_v_outnbelement), (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_outreal)) + __pyx_v_lookback));
        |                     ^~~~~~~~~
        |                     TA_STDDEV
  talib/_ta_lib.c: In function ‘__pyx_pf_5talib_7_ta_lib_212IMI’:
  talib/_ta_lib.c:35018:40: warning: implicit declaration of function ‘TA_IMI_Lookback’; did you mean ‘TA_WMA_Lookback’? [-Wimplicit-function-declar
ation]
  35018 |   __pyx_v_lookback = (__pyx_v_begidx + TA_IMI_Lookback(__pyx_v_timeperiod));
        |                                        ^~~~~~~~~~~~~~~
        |                                        TA_WMA_Lookback
  talib/_ta_lib.c:35025:21: warning: implicit declaration of function ‘TA_IMI’; did you mean ‘TA_WMA’? [-Wimplicit-function-declaration]
  35025 |   __pyx_v_retCode = TA_IMI(0, __pyx_v_endidx, (((double *)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_open)) + __pyx_v_begidx), (((double *
)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_close)) + __pyx_v_begidx), __pyx_v_timeperiod, (&__pyx_v_outbegidx), (&__pyx_v_outnbelement), (((double 
*)__pyx_f_5numpy_7ndarray_4data_data(__pyx_v_outreal)) + __pyx_v_lookback));
        |                     ^~~~~~
        |                     TA_WMA
  gcc -pthread -shared build/temp.linux-x86_64-cpython-39/talib/_ta_lib.o -L/usr/lib -L/usr/local/lib -L/usr/lib64 -L/usr/local/lib64 -L/opt/lib -L/
opt/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/ta-lib/lib -L/usr/local/lib -Wl,--enable-new-dtags,-rpath,/usr/lib -Wl,--enable-new-dtags,-rpa
th,/usr/local/lib -Wl,--enable-new-dtags,-rpath,/usr/lib64 -Wl,--enable-new-dtags,-rpath,/usr/local/lib64 -Wl,--enable-new-dtags,-rpath,/opt/lib -Wl
,--enable-new-dtags,-rpath,/opt/local/lib -Wl,--enable-new-dtags,-rpath,/opt/homebrew/lib -Wl,--enable-new-dtags,-rpath,/opt/homebrew/opt/ta-lib/lib
 -lta-lib -o build/lib.linux-x86_64-cpython-39/talib/_ta_lib.cpython-39-x86_64-linux-gnu.so
  /usr/bin/ld: cannot find -lta-lib
  collect2: error: ld returned 1 exit status
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for ta-lib
Failed to build ta-lib
ERROR: Could not build wheels for ta-lib which use PEP 517 and cannot be installed directly

[edit by admin: formatting]

You need to use the ta-lib python package that matches the library that we have install. So, if you do

pip install --user 'ta-lib<0.5'

it will install correctly.

To help others in future, we have added a help page about this