TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.49k stars 1.74k forks source link

ta-lib fail to install on Oracle Ampere Machine #505

Closed ngloom closed 2 years ago

ngloom commented 2 years ago

Hi, Thanks for the great work first. I recently do some research work on the Oracle Cloud Ampere Machine (arm based processor), you can easily get one always free trial machine in oracle cloud for re-run the install process.

the console error is as below:

$ pip install ta-lib
Collecting ta-lib
  Using cached TA-Lib-0.4.24.tar.gz (269 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in /home/ubuntu/miniconda3/envs/bian/lib/python3.9/site-packages (from ta-lib) (1.22.2)
Building wheels for collected packages: ta-lib
  Building wheel for ta-lib (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.9
      creating build/lib.linux-aarch64-3.9/talib
      copying talib/abstract.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/deprecated.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_stream.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_func.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_pandas.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_data.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/__init__.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_polars.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_abstract.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/stream.py -> build/lib.linux-aarch64-3.9/talib
      running build_ext
      skipping 'talib/_ta_lib.c' Cython extension (up-to-date)
      building 'talib._ta_lib' extension
      creating build/temp.linux-aarch64-3.9
      creating build/temp.linux-aarch64-3.9/talib
      gcc -pthread -B /home/ubuntu/miniconda3/envs/bian/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /home/ubuntu/miniconda3/envs/bian/include -I/home/ubuntu/miniconda3/envs/bian/include -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /home/ubuntu/miniconda3/envs/bian/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/home/ubuntu/miniconda3/envs/bian/lib/python3.9/site-packages/numpy/core/include -I/home/ubuntu/miniconda3/envs/bian/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-aarch64-3.9/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
  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: subprocess-exited-with-error

  × Running setup.py install for ta-lib did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.9
      creating build/lib.linux-aarch64-3.9/talib
      copying talib/abstract.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/deprecated.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_stream.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_func.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_pandas.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_data.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/__init__.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_polars.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/test_abstract.py -> build/lib.linux-aarch64-3.9/talib
      copying talib/stream.py -> build/lib.linux-aarch64-3.9/talib
      running build_ext
      skipping 'talib/_ta_lib.c' Cython extension (up-to-date)
      building 'talib._ta_lib' extension
      creating build/temp.linux-aarch64-3.9
      creating build/temp.linux-aarch64-3.9/talib
      gcc -pthread -B /home/ubuntu/miniconda3/envs/bian/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /home/ubuntu/miniconda3/envs/bian/include -I/home/ubuntu/miniconda3/envs/bian/include -fPIC -O2 -n1 .2-a+fp16+rcpc+dotprod+crypto -isystem /home/ubuntu/miniconda3/envs/bian/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/home/ubuntu/miniconda3/envs/bian/lib/python3.9/site-packages/numpy/core/include -I/home/ubuntu/miniconda3/envs/bian/include/python3.9 -c talib/_ta_lib.c -o build/temp.linux-aarch64-3.9/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: legacy-install-failure

× Encountered error while trying to install package.
╰─> ta-lib

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
trufanov-nok commented 2 years ago

Well, people around says that it might be something wrong with CFLAGS formatting and it's supposed to be -march=armv8.2-a+fp16+rcpc+dotprod+crypto -mtune=neoverse-n1 instead of a just ".2-a+fp16+rcpc+dotprod+crypt -n1" or something like that.

Unfortunatelly I can't try it as Oracle has blacklisted my country and even free account requires assigned bankcard which are banned too. Could you temporaly provide a free account credentials for testing purposes?

mrjbq7 commented 2 years ago

Closing all installation issues, if someone has a specific problem please open a new one.

ersanKolay commented 3 months ago

Download and extract TA-Lib source code

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

Navigate to the TA-Lib directory cd ta-lib Configure, build, and install TA-Lib with explicit build type

./configure --build=aarch64-unknown-linux-gnu --prefix=/usr
make
sudo make install

Install the TA-Lib Python wrapper

pip3 install ta-lib

mrjbq7 commented 3 months ago

what's the question

ersanKolay commented 3 months ago

what's the question

It seems that on ARM processors, it's necessary to explicitly specify the build configuration. On my Oracle server with an ARM processor, it didn't work initially. As a solution, I specified the build configuration using ./configure --build=aarch64-unknown-linux-gnu --prefix=/usr.

mrjbq7 commented 3 months ago

Ah, I didn't notice. Thanks for contributing that -- I have added it as a note in the README.

8750506cfb63979dca12a581b698a5a9a6c898d6

briancappello commented 3 months ago

Ah nice, this is an easier solution than what I found. Traceback on M2 for people searching:

$ ./configure --prefix=/usr
# ...
checking build system type... ./config.guess: unable to guess system type

This script, last modified 2006-07-02, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from

  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
and
  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub

If the version you run (./config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.

config.guess timestamp = 2006-07-02

uname -m = aarch64
uname -r = 6.8.10-400.asahi.fc40.aarch64+16k
uname -s = Linux
uname -v = #1 SMP PREEMPT_DYNAMIC Mon May 27 16:05:41 UTC 2024

/usr/bin/uname -p = unknown
/bin/uname -X     = 

hostinfo               = 
/bin/universe          = 
/usr/bin/arch -k       = 
/bin/arch              = aarch64
/usr/bin/oslevel       = 
/usr/convex/getsysinfo = 

UNAME_MACHINE = aarch64
UNAME_RELEASE = 6.8.10-400.asahi.fc40.aarch64+16k
UNAME_SYSTEM  = Linux

Another way to solve this is to copy a newer version of config.guess into the ta-lib sources:

$ cp /usr/share/automake-1.16/config.guess /path/to/extracted/ta-lib/config.guess

And then re-run configure:

./configure --prefix=/usr