3

I'm trying to get install TA-lib, but running into errors I don't understand.

I installed brew, and ran the following: brew install ta-lib

That seemed to work because if I re-run that, I get a note that ta-lib 0.4.0 is already installed and up-to-date

However, running pip3 install ta-lib results in the following errors. From googling around, this seems to happen when ta-lib wasn't installed first, but not sure how to address when the initial install seems to go fine.

pip3 install TA-lib
Collecting TA-lib
  Using cached TA-Lib-0.4.19.tar.gz (267 kB)
Requirement already satisfied: numpy in /Users/mf/venv/lib/python3.8/site-packages (from TA-lib) (1.19.5)
Using legacy 'setup.py install' for TA-lib, since package 'wheel' is not installed.
Installing collected packages: TA-lib
    Running setup.py install for TA-lib ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/mf/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py'"'"'; __file__='"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-record-q2zdmts7/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mf/venv/include/site/python3.8/TA-lib
         cwd: /private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/
    Complete output (27 lines):
    /private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
      warnings.warn('Cannot find ta-lib library, installation may fail.')
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14.6-x86_64-3.8
    creating build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/abstract.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/test_abstract.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/deprecated.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/stream.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/test_pandas.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/test_data.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/test_func.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    copying talib/test_stream.py -> build/lib.macosx-10.14.6-x86_64-3.8/talib
    running build_ext
    building 'talib._ta_lib' extension
    creating build/temp.macosx-10.14.6-x86_64-3.8
    creating build/temp.macosx-10.14.6-x86_64-3.8/talib
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I/usr/include -I/usr/local/include -I/opt/include -I/opt/local/include -I/Users/mf/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/mf/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c talib/_ta_lib.c -o build/temp.macosx-10.14.6-x86_64-3.8/talib/_ta_lib.o
    talib/_ta_lib.c:611:10: fatal error: 'ta-lib/ta_defs.h' file not found
    #include "ta-lib/ta_defs.h"
             ^~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/mf/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py'"'"'; __file__='"'"'/private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-install-armqiybl/ta-lib_03c018e0f8f24266a3c6fc47436cf143/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/p3/nd5fr9yd2xb7qnjnln6vk2cw0000gn/T/pip-record-q2zdmts7/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mf/venv/include/site/python3.8/TA-lib Check the logs for full command output.

I updated TA_LIBRARY_PATH & TA_INCLUDE_PATH after finding where brew was installing ta-lib, ran the following and pip3 install seemed to work properly, but I wasn't able to actually import it. After trying to re-install ta-lib, I get the same error as above.

export TA_LIBRARY_PATH=/opt/homebrew/opt/ta-lib/lib
export TA_INCLUDE_PATH=/opt/homebrew/opt/ta-lib/include
JstSomeGuy
  • 119
  • 7

0 Answers0