The steps I used are below
apt install -y build-essential automake
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar zxvf ta-lib-0.4.0-src.tar.gz
cd ta-lib
cp /usr/share/automake-1.16/config.guess .
./configure --prefix=/usr
make && make install
pip install TA-Lib
The error I found in my terminal for pip install TA-Lib
as below
(base) root@ubuntu:~/ta-lib# pip install TA-Lib
Collecting TA-Lib
Using cached TA-Lib-0.4.25.tar.gz (271 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /root/anaconda3/lib/python3.9/site-packages (from TA-Lib) (1.21.5)
Building wheels for collected packages: TA-Lib
Building wheel for TA-Lib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for TA-Lib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [26 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-39
creating build/lib.linux-aarch64-cpython-39/talib
copying talib/test_abstract.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/deprecated.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_pandas.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/stream.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_func.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/abstract.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_data.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/__init__.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_stream.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_polars.py -> build/lib.linux-aarch64-cpython-39/talib
running build_ext
building 'talib._ta_lib' extension
creating build/temp.linux-aarch64-cpython-39
creating build/temp.linux-aarch64-cpython-39/talib
gcc -pthread -B /root/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -n1 .2-a fp16 rcpc dotprod crypto -isystem /root/anaconda3/include -I/root/anaconda3/include -fPIC -O2 -n1 .2-a fp16 rcpc dotprod crypto -isystem /root/anaconda3/include -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-bjd5n583/normal/lib/python3.9/site-packages/numpy/core/include -I/root/anaconda3/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-aarch64-cpython-39/talib/_ta_lib.o
gcc: error: .2-a fp16 rcpc dotprod crypto: No such file or directory
gcc: error: .2-a fp16 rcpc dotprod crypto: No such file or directory
gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for TA-Lib
Failed to build TA-Lib
ERROR: Could not build wheels for TA-Lib, which is required to install pyproject.toml-based projects
Try build from source
git clone https://github.com/mrjbq7/ta-lib.git
cd ta-lib
python3 setup.py install
The error as below
(base) root@ubuntu:~/ta-lib# python3 setup.py install
running install
/root/anaconda3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/root/anaconda3/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
creating TA_Lib.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
writing manifest file 'TA_Lib.egg-info/SOURCES.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'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-aarch64-cpython-39
creating build/lib.linux-aarch64-cpython-39/talib
copying talib/test_abstract.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/deprecated.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_pandas.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/stream.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_func.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/abstract.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_data.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/__init__.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_stream.py -> build/lib.linux-aarch64-cpython-39/talib
copying talib/test_polars.py -> build/lib.linux-aarch64-cpython-39/talib
running build_ext
skipping 'talib/_ta_lib.c' Cython extension (up-to-date)
building 'talib._ta_lib' extension
creating build/temp.linux-aarch64-cpython-39
creating build/temp.linux-aarch64-cpython-39/talib
gcc -pthread -B /root/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -n1 .2-a fp16 rcpc dotprod crypto -isystem /root/anaconda3/include -I/root/anaconda3/include -fPIC -O2 -n1 .2-a fp16 rcpc dotprod crypto -isystem /root/anaconda3/include -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/root/anaconda3/lib/python3.9/site-packages/numpy/core/include -I/root/anaconda3/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-aarch64-cpython-39/talib/_ta_lib.o
gcc: error: .2-a fp16 rcpc dotprod crypto: No such file or directory
gcc: error: .2-a fp16 rcpc dotprod crypto: No such file or directory
gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
gcc: error: unrecognized command line option ‘-n1’; did you mean ‘-n’?
error: command '/usr/bin/gcc' failed with exit code 1
CodePudding user response:
From what I can tell, the Anaconda latest distribution for AArch64 is broken with a corrupted _sysconfigdata__linux_aarch64-linux-gnu.py file in /lib/python3.9/. If you fix that file the TA-lib package will build properly. setup.py reads that file to get the build parameters to match the python install.
Patch file: https://gist.github.com/geoffreyblake/bcbb185b03e5343e82707abc6c5806a6
Issue opened to Anaconda repo: https://github.com/ContinuumIO/anaconda-issues/issues/13106
Hopefully the Anaconda team will fix this quickly.
System python3.8 on Ubuntu20.04 is fine, FYI, if you can live with using that version for now.
CodePudding user response:
The problem be solved by uninstall anaconda.
I installed talib successfully in the original python of ARM64 Ubuntu 20.04.