Saturday, 22 January 2022

Install TA-LIB with clang compiler error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory

Setup

Using an ubuntu20 t2.micro on AWS

sudo apt-get install python3 clang # Make sure gcc is not used instead of clang

Install the TA-LIB C library.

wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar zxvf
cd ta-lib
./configure --prefix=/usr
make
sudo make install

Install pip, python3-dev, python3.9-dev, and the python TA-LIB wrapper

sudo curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo CC=clang python3.9 get-pip.py 
sudo apt-get install python3-dev python3.9-dev
sudo CC=clang python3.9 -m pip install TA-LIB

Errors

I receive this error output from the last command

$ CC=clang python3.9 -m pip install TA-LIB
Defaulting to user installation because normal site-packages is not writeable
Collecting TA-LIB
  Using cached TA-Lib-0.4.24.tar.gz (269 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in ./.local/lib/python3.9/site-packages (from TA-LIB) (1.22.1)
Building wheels for collected packages: TA-LIB
  Building wheel for TA-LIB (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/setup.py'"'"'; __file__='"'"'/tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ay3k6nzj
       cwd: /tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/
  Complete output (61 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/talib
  copying talib/abstract.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/stream.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/test_stream.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/test_polars.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/test_pandas.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/test_abstract.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/test_func.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/test_data.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/deprecated.py -> build/lib.linux-x86_64-3.9/talib
  copying talib/__init__.py -> build/lib.linux-x86_64-3.9/talib
  running build_ext
  building 'talib._ta_lib' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/talib
  clang -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -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/home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.9/talib/_ta_lib.o
  In file included from talib/_ta_lib.c:689:
  In file included from /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
  In file included from /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
  In file included from /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960:
  /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
  #warning "Using deprecated NumPy API, disable it with " \
   ^
  talib/_ta_lib.c:38706:103: warning: passing 'TA_FuncInfo **' (aka 'struct TA_FuncInfo **') to parameter of type 'const TA_FuncInfo **' (aka 'const struct TA_FuncInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    __pyx_v_retCode = TA_GetFuncInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), (&__pyx_v_info));
                                                                                                        ^~~~~~~~~~~~~~~
  /usr/local/include/ta-lib/ta_abstract.h:211:48: note: passing argument to parameter 'funcInfo' here
                             const TA_FuncInfo **funcInfo );
                                                 ^
  talib/_ta_lib.c:38977:126: warning: passing 'TA_InputParameterInfo **' (aka 'struct TA_InputParameterInfo **') to parameter of type 'const TA_InputParameterInfo **' (aka 'const struct TA_InputParameterInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    __pyx_v_retCode = TA_GetInputParameterInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), __pyx_v_idx, (&__pyx_v_info));
                                                                                                                               ^~~~~~~~~~~~~~~
  /usr/local/include/ta-lib/ta_abstract.h:442:68: note: passing argument to parameter 'info' here
                                       const TA_InputParameterInfo **info );
                                                                     ^
  talib/_ta_lib.c:39227:129: warning: passing 'TA_OptInputParameterInfo **' (aka 'struct TA_OptInputParameterInfo **') to parameter of type 'const TA_OptInputParameterInfo **' (aka 'const struct TA_OptInputParameterInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    __pyx_v_retCode = TA_GetOptInputParameterInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), __pyx_v_idx, (&__pyx_v_info));
                                                                                                                                  ^~~~~~~~~~~~~~~
  /usr/local/include/ta-lib/ta_abstract.h:446:74: note: passing argument to parameter 'info' here
                                          const TA_OptInputParameterInfo **info );
                                                                           ^
  talib/_ta_lib.c:39473:127: warning: passing 'TA_OutputParameterInfo **' (aka 'struct TA_OutputParameterInfo **') to parameter of type 'const TA_OutputParameterInfo **' (aka 'const struct TA_OutputParameterInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    __pyx_v_retCode = TA_GetOutputParameterInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), __pyx_v_idx, (&__pyx_v_info));
                                                                                                                                ^~~~~~~~~~~~~~~
  /usr/local/include/ta-lib/ta_abstract.h:450:70: note: passing argument to parameter 'info' here
                                        const TA_OutputParameterInfo **info );
                                                                       ^
  talib/_ta_lib.c:40072:125: warning: passing 'TA_FuncHandle **' (aka 'unsigned int **') to parameter of type 'const TA_FuncHandle **' (aka 'const unsigned int **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
    __pyx_t_1 = __pyx_f_5talib_7_ta_lib__ta_check_success(__pyx_n_s_TA_GetFuncHandle, TA_GetFuncHandle(__pyx_v_function_name, (&__pyx_v_handle)), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 751, __pyx_L1_error)
                                                                                                                              ^~~~~~~~~~~~~~~~~
  /usr/local/include/ta-lib/ta_abstract.h:155:52: note: passing argument to parameter 'handle' here
                               const TA_FuncHandle **handle );
                                                     ^
  6 warnings generated.
  x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.9/talib/_ta_lib.o -L/usr/local/lib -L/usr/local/lib64 -L/opt/lib -L/opt/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/ta-lib/lib -Wl,--enable-new-dtags,-R/usr/local/lib -Wl,--enable-new-dtags,-R/usr/local/lib64 -Wl,--enable-new-dtags,-R/opt/lib -Wl,--enable-new-dtags,-R/opt/local/lib -Wl,--enable-new-dtags,-R/opt/homebrew/lib -Wl,--enable-new-dtags,-R/opt/homebrew/opt/ta-lib/lib -lta_lib -o build/lib.linux-x86_64-3.9/talib/_ta_lib.cpython-39-x86_64-linux-gnu.so
  error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory
  ----------------------------------------
  ERROR: Failed building wheel for TA-LIB
  Running setup.py clean for TA-LIB
Failed to build TA-LIB
Installing collected packages: TA-LIB
    Running setup.py install for TA-LIB ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/setup.py'"'"'; __file__='"'"'/tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-3qtsugx0/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ubuntu/.local/include/python3.9/TA-LIB
         cwd: /tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/
    Complete output (61 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/talib
    copying talib/abstract.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/stream.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/test_stream.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/test_polars.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/test_pandas.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/test_abstract.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/test_func.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/test_data.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/deprecated.py -> build/lib.linux-x86_64-3.9/talib
    copying talib/__init__.py -> build/lib.linux-x86_64-3.9/talib
    running build_ext
    building 'talib._ta_lib' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/talib
    clang -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -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/home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.9/talib/_ta_lib.o
    In file included from talib/_ta_lib.c:689:
    In file included from /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
    In file included from /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
    In file included from /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960:
    /home/ubuntu/.local/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it with " \
     ^
    talib/_ta_lib.c:38706:103: warning: passing 'TA_FuncInfo **' (aka 'struct TA_FuncInfo **') to parameter of type 'const TA_FuncInfo **' (aka 'const struct TA_FuncInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
      __pyx_v_retCode = TA_GetFuncInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), (&__pyx_v_info));
                                                                                                          ^~~~~~~~~~~~~~~
    /usr/local/include/ta-lib/ta_abstract.h:211:48: note: passing argument to parameter 'funcInfo' here
                               const TA_FuncInfo **funcInfo );
                                                   ^
    talib/_ta_lib.c:38977:126: warning: passing 'TA_InputParameterInfo **' (aka 'struct TA_InputParameterInfo **') to parameter of type 'const TA_InputParameterInfo **' (aka 'const struct TA_InputParameterInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
      __pyx_v_retCode = TA_GetInputParameterInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), __pyx_v_idx, (&__pyx_v_info));
                                                                                                                                 ^~~~~~~~~~~~~~~
    /usr/local/include/ta-lib/ta_abstract.h:442:68: note: passing argument to parameter 'info' here
                                         const TA_InputParameterInfo **info );
                                                                       ^
    talib/_ta_lib.c:39227:129: warning: passing 'TA_OptInputParameterInfo **' (aka 'struct TA_OptInputParameterInfo **') to parameter of type 'const TA_OptInputParameterInfo **' (aka 'const struct TA_OptInputParameterInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
      __pyx_v_retCode = TA_GetOptInputParameterInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), __pyx_v_idx, (&__pyx_v_info));
                                                                                                                                    ^~~~~~~~~~~~~~~
    /usr/local/include/ta-lib/ta_abstract.h:446:74: note: passing argument to parameter 'info' here
                                            const TA_OptInputParameterInfo **info );
                                                                             ^
    talib/_ta_lib.c:39473:127: warning: passing 'TA_OutputParameterInfo **' (aka 'struct TA_OutputParameterInfo **') to parameter of type 'const TA_OutputParameterInfo **' (aka 'const struct TA_OutputParameterInfo **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
      __pyx_v_retCode = TA_GetOutputParameterInfo(__pyx_f_5talib_7_ta_lib___ta_getFuncHandle(__pyx_v_function_name), __pyx_v_idx, (&__pyx_v_info));
                                                                                                                                  ^~~~~~~~~~~~~~~
    /usr/local/include/ta-lib/ta_abstract.h:450:70: note: passing argument to parameter 'info' here
                                          const TA_OutputParameterInfo **info );
                                                                         ^
    talib/_ta_lib.c:40072:125: warning: passing 'TA_FuncHandle **' (aka 'unsigned int **') to parameter of type 'const TA_FuncHandle **' (aka 'const unsigned int **') discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
      __pyx_t_1 = __pyx_f_5talib_7_ta_lib__ta_check_success(__pyx_n_s_TA_GetFuncHandle, TA_GetFuncHandle(__pyx_v_function_name, (&__pyx_v_handle)), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 751, __pyx_L1_error)
                                                                                                                                ^~~~~~~~~~~~~~~~~
    /usr/local/include/ta-lib/ta_abstract.h:155:52: note: passing argument to parameter 'handle' here
                                 const TA_FuncHandle **handle );
                                                       ^
    6 warnings generated.
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.9/talib/_ta_lib.o -L/usr/local/lib -L/usr/local/lib64 -L/opt/lib -L/opt/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/ta-lib/lib -Wl,--enable-new-dtags,-R/usr/local/lib -Wl,--enable-new-dtags,-R/usr/local/lib64 -Wl,--enable-new-dtags,-R/opt/lib -Wl,--enable-new-dtags,-R/opt/local/lib -Wl,--enable-new-dtags,-R/opt/homebrew/lib -Wl,--enable-new-dtags,-R/opt/homebrew/opt/ta-lib/lib -lta_lib -o build/lib.linux-x86_64-3.9/talib/_ta_lib.cpython-39-x86_64-linux-gnu.so
    error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/setup.py'"'"'; __file__='"'"'/tmp/pip-install-btb1_xuf/ta-lib_0aa6c802ac734a0dbb58621b44b06499/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-3qtsugx0/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ubuntu/.local/include/python3.9/TA-LIB Check the logs for full command output.

The most important line from that looks like

error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory

When I run clang++ -v I get

$ clang++ -v
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/9
Candidate multilib: .;@m64
Selected multilib: .;@m64

Attempted solutions

I have installed already tried installing these packages to try and fix it: python3-clang-9, autoconf, libtool, pkg-config

installing build-essential is not an option because it installs gcc and I am trying to use clang instead of gcc



from Install TA-LIB with clang compiler error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory

No comments:

Post a Comment