kamil ural
kamil ural

Reputation: 1

Error Installing TA-Lib on Google Colab After Recent Update: Failed Building Wheel

I encountered an issue while trying to install the TA-Lib library on Google Colab after its recent update. Previously, I was able to install it using the following commands:

!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 TA-Lib==0.4.19

However, when I run this code now, I receive the following error:

Using pip 24.1.2 from /usr/local/lib/python3.11/dist-packages/pip (python 3.11)
Collecting TA-Lib==0.4.19
  Using cached TA-Lib-0.4.19.tar.gz (267 kB)
  Running command python setup.py egg_info
  /usr/local/lib/python3.11/dist-packages/setuptools/__init__.py:94: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
  !!

          ********************************************************************************
          Requirements should be satisfied by a PEP 517 installer.
          If you are using pip, you can try `pip install --use-pep517`.
          ********************************************************************************

  !!
    dist.fetch_build_eggs(dist.setup_requires)
  running egg_info
  creating /tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info
  writing /tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info/dependency_links.txt
  writing requirements to /tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info/requires.txt
  writing top-level names to /tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info/top_level.txt
  writing manifest file '/tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info/SOURCES.txt'
  reading manifest file '/tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'LICENSE'
  writing manifest file '/tmp/pip-pip-egg-info-dz2n0g3u/TA_Lib.egg-info/SOURCES.txt'
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in /usr/local/lib/python3.11/dist-packages (from TA-Lib==0.4.19) (1.26.4)
Building wheels for collected packages: TA-Lib
  Running command python setup.py bdist_wheel
  /usr/local/lib/python3.11/dist-packages/setuptools/__init__.py:94: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
  !!

          ********************************************************************************
          Requirements should be satisfied by a PEP 517 installer.
          If you are using pip, you can try `pip install --use-pep517`.
          ********************************************************************************

  !!
    dist.fetch_build_eggs(dist.setup_requires)
  running bdist_wheel
  running build
  running build_py
  creating build/lib.linux-x86_64-cpython-311/talib
  copying talib/stream.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/test_data.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/test_stream.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/test_abstract.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/__init__.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/abstract.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/test_pandas.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/test_func.py -> build/lib.linux-x86_64-cpython-311/talib
  copying talib/deprecated.py -> build/lib.linux-x86_64-cpython-311/talib
  running build_ext
  building 'talib._ta_lib' extension
  creating build/temp.linux-x86_64-cpython-311/talib
  x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/usr/local/lib/python3.11/dist-packages/numpy/core/include -I/usr/include/python3.11 -c talib/_ta_lib.c -o build/temp.linux-x86_64-cpython-311/talib/_ta_lib.o
  talib/_ta_lib.c:196:12: fatal error: longintrepr.h: No such file or directory
    196 |   #include "longintrepr.h"
        |            ^~~~~~~~~~~~~~~

compilation terminated. error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1 error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /usr/bin/python3 -u -c ' exec(compile('"'"''"'"''"'"' # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py # # - It imports setuptools before invoking setup.py, to enable projects that directly # import from `distutils.core` to work with newer packaging standards. # - It provides a clear error message when setuptools is not installed. # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so # setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning: # manifest_maker: standard file '"'"'-c'"'"' not found". # - It generates a shim setup.py, for handling setup.cfg-only projects. import os, sys, tokenize try: import setuptools except ImportError as error: print( "ERROR: Can not execute `setup.py` since setuptools is not available in " "the build environment.", file=sys.stderr, ) sys.exit(1) _file_ = %r sys.argv[0] = _file_ if os.path.exists(_file_): filename = _file_ with tokenize.open(_file_) as f: setup_py_code = f.read() else: filename = "<auto-generated setuptools caller>" setup_py_code = "from setuptools import setup; setup()" exec(compile(setup_py_code, filename, "exec")) '"'"''"'"''"'"' % ('"'"'/tmp/pip-install-cqn7e6xj/ta-lib_950d1d87302b426fb205e5027d92341f/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' bdist_wheel -d /tmp/pip-wheel-sdmbwl9w cwd: /tmp/pip-install-cqn7e6xj/ta-lib_950d1d87302b426fb205e5027d92341f/ Building wheel for TA-Lib (setup.py) ... error ERROR: Failed building wheel for TA-Lib Running setup.py clean for TA-Lib Running command python setup.py clean /usr/local/lib/python3.11/dist-packages/setuptools/_init_.py:94: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. !! ******************************************************************************** Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try `pip install --use-pep517`. ******************************************************************************** !! dist.fetch_build_eggs(dist.setup_requires) running clean removing 'build/temp.linux-x86_64-cpython-311' (and everything under it) removing 'build/lib.linux-x86_64-cpython-311' (and everything under it) 'build/bdist.linux-x86_64' does not exist -- can't clean it 'build/scripts-3.11' does not exist -- can't clean it removing 'build' Failed to build TA-Lib ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (TA-Lib)

Upvotes: -1

Views: 124

Answers (2)

korakot
korakot

Reputation: 40908

For a somewhat fast installation.

url = 'https://anaconda.org/conda-forge/libta-lib/0.4.0/download/linux-64/libta-lib-0.4.0-h166bdaf_1.tar.bz2'
!curl -L $url | tar xj -C /usr/lib/x86_64-linux-gnu/ lib --strip-components=1
!pip install conda-package-handling
!wget https://anaconda.org/conda-forge/ta-lib/0.5.1/download/linux-64/ta-lib-0.5.1-py311h9ecbd09_0.conda
!cph x ta-lib-0.5.1-py311h9ecbd09_0.conda
!mv ./ta-lib-0.5.1-py311h9ecbd09_0/lib/python3.11/site-packages/talib /usr/local/lib/python3.11/dist-packages/
import talib

Upvotes: 0

Gangashekar
Gangashekar

Reputation: 1

Try this; it worked for me:

!curl -L http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz -O && tar xzvf ta-lib-0.4.0-src.tar.gz
!cd ta-lib && ./configure --prefix=/usr && make && make install && cd - && pip install TA-Lib==0.4.37 --no-cache-dir --force

Upvotes: 0

Related Questions