TA-Lib / ta-lib-python

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

How to install on a linux server without sudo privilege ? #538

Open ghost opened 2 years ago

ghost commented 2 years ago

Hi,

I tried to install but I failed on a linux server + cpanel that I use to host websites.

I have done this : 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/ then because I don't have root access and admin rights I have done this :

export TA_LIBRARY_PATH=/home/myfolder/public_html/python/trading_strategies/ta-lib/lib
export TA_INCLUDE_PATH=/home/myfolder/public_html/python/trading_strategies/ta-lib/include
make
make install

then pip install ta-lib

And I have this results: What do you think ? What should I do ?

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/myfolder/virtualenv/public_html/python/trading_strategies/3.10/lib64/python3.10/site-packages (from ta-lib) (1.23.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
  ╰─> [21 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/talib
      copying talib/__init__.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/abstract.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/deprecated.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/stream.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_abstract.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_data.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_func.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_pandas.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_polars.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_stream.py -> build/lib.linux-x86_64-3.10/talib
      running build_ext
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/talib
      /opt/rh/devtoolset-7/root/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -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/myfolder/public_html/python/trading_strategies/ta-lib/include -I/home/myfolder/virtualenv/public_html/python/trading_strategies/3.10/lib64/python3.10/site-packages/numpy/core/include -I/home/myfolder/virtualenv/public_html/python/trading_strategies/3.10/include -I/opt/alt/python310/include/python3.10 -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.10/talib/_ta_lib.o
      error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
      [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
  ╰─> [23 lines of output]
      running install
      /home/myfolder/virtualenv/public_html/python/trading_strategies/3.10/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/talib
      copying talib/__init__.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/abstract.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/deprecated.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/stream.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_abstract.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_data.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_func.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_pandas.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_polars.py -> build/lib.linux-x86_64-3.10/talib
      copying talib/test_stream.py -> build/lib.linux-x86_64-3.10/talib
      running build_ext
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/talib
      /opt/rh/devtoolset-7/root/usr/bin/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -D_GNU_SOURCE -fPIC -fwrapv -O2 -fno-semantic-interposition -pthread -Wno-unused-result -Wsign-compare -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -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/myfolder/public_html/python/trading_strategies/ta-lib/include -I/home/myfolder/virtualenv/public_html/python/trading_strategies/3.10/lib64/python3.10/site-packages/numpy/core/include -I/home/myfolder/virtualenv/public_html/python/trading_strategies/3.10/include -I/opt/alt/python310/include/python3.10 -c talib/_ta_lib.c -o build/temp.linux-x86_64-3.10/talib/_ta_lib.o
      error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
      [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.
mrjbq7 commented 2 years ago

Did you see the error?

      error: command '/opt/rh/devtoolset-7/root/usr/bin/gcc' failed: No such file or directory
ghost commented 2 years ago

thanks for replying. I have seen this but I am not sure what to do with it. I believe it comes from that I don't have root & admin so it cannot create this folder. Or that I need to install gcc as I read somewhere but since I was not able to install it without root&admin access. I am only a beginner with linux.

mrjbq7 commented 2 years ago

as far as I can tell, you need a C compiler to install it...

ghost commented 2 years ago
((trading/strategies:3.10)) [thomjyty@world-394 trading_strategies]$ which gcc
/usr/bin/gcc
((trading/strategies:3.10)) [thomjyty@world-394 trading_strategies]$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This is what I see.

trufanov-nok commented 2 years ago

I just googled for /opt/rh/devtoolset-7 and found

Use which g++ to see which compiler is in your path. The RHDTS GCC executable path will begin with /opt/rh. Alternatively, use g++ -v to confirm that the version number is the correct one for RHDTS.

$ which g++
/opt/rh/devtoolset-7/root/usr/bin/gcc
$ g++ -v
g++ (GCC) 7.2.1 20170729 (Red Hat 7.2.1-1)

If which returns /usr/bin/g++, or g++ -v shows a different version, you need to run scl enable to add RHDTS GCC and the rest of RHDTS to your environment.

$ scl enable devtoolset-7 bash

I guess you need to execute this from the same account you used to wget the TA-Lib

ghost commented 2 years ago

thanks for replying It gaves me Unable to open /etc/scl/conf/devtoolset-7!

trufanov-nok commented 2 years ago

Perhaps it does related to the lack of administrative rights, but it's not related to ta-lib. It's about accessing to gcc. Could you ask server support for advise?

ghost commented 2 years ago

I won't ask the hosting service support because mostly they advise to buy an hosting plan with admin rights and that what I ask is not included in my plan. Which they are not wrong. I have found an alternative as a pure python library so I am not gonna use Ta-Lib. thanks everyone !