Hi
I am unable to install this TA-Lib library on my mac M1, please suggest a workaround or how can i install and practice the notebooks.
thanks
Hi Jay,
Can you share the error you are getting while installing the library and the Anaconda and Python versions? It will help us understand and debug the error. Also, meanwhile, you can run the notebooks on Google Colab.
Hi Akshay
I get this error on all platforms, i.e. I tried installing on my Mac M1, Windows 10 , and even to my surprise on google colab. Not sure what is missing from my end. I used the pip install TA-Lib command for installation. Also i was unable to change my anaconda env to quantra_py due to some conflicts in packages. However please see the error below while installing TA_LIb
Collecting TA-lib Using cached TA-Lib-0.4.28.tar.gz (357 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 /Users/jaypitale/opt/anaconda3/lib/python3.8/site-packages (from TA-lib) (1.24.4) 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 ??> [21 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.9-x86_64-cpython-38 creating build/lib.macosx-10.9-x86_64-cpython-38/talib copying talib/abstract.py -> build/lib.macosx-10.9-x86_64-cpython-38/talib copying talib/deprecated.py -> build/lib.macosx-10.9-x86_64-cpython-38/talib copying talib/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-38/talib copying talib/stream.py -> build/lib.macosx-10.9-x86_64-cpython-38/talib running build_ext building 'talib._ta_lib' extension creating build/temp.macosx-10.9-x86_64-cpython-38 creating build/temp.macosx-10.9-x86_64-cpython-38/talib gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/jaypitale/opt/anaconda3/include -arch x86_64 -I/Users/jaypitale/opt/anaconda3/include -arch x86_64 -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/private/var/folders/2y/dk3slpv11mv2l9t57_m2ybl00000gn/T/pip-build-env-f_iinm_2/normal/lib/python3.8/site-packages/numpy/core/include -I/Users/jaypitale/opt/anaconda3/include/python3.8 -c talib/_ta_lib.c -o build/temp.macosx-10.9-x86_64-cpython-38/talib/_ta_lib.o talib/_ta_lib.c:1082:10: fatal error: 'ta-lib/ta_defs.h' file not found #include "ta-lib/ta_defs.h" ^~~~~~~~~~~~~~~~~~ 1 error generated. <string>:77: UserWarning: Cannot find ta-lib library, installation may fail. 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 Note: you may need to restart the kernel to use updated packages. ------------------------------------------------------------------------------ thanks Jay
Hi Jay,
Can you try installing talib using the following command on your Mac/Windows system:
conda install -c conda-forge ta-lib
You can also refer to this blog for more detailed steps.
Also, for Google Colab, you can run the following command:
url = 'https://anaconda.org/conda-forge/libta-lib/0.4.0/download/linux-64/libta-lib-0.4.0-h166bdaf_1.tar.bz2'
!curl -L $url | tar xj -C /usr/lib/x86_64-linux-gnu/ lib --strip-components=1
url = 'https://anaconda.org/conda-forge/ta-lib/0.4.19/download/linux-64/ta-lib-0.4.19-py310hde88566_4.tar.bz2'
!curl -L $url | tar xj -C /usr/local/lib/python3.10/dist-packages/ lib/python3.10/site-packages/talib --strip-components=3
import talib
This should run without any error, and you will be able to use talib.
Please let us know if you still face any issues.
Hi Akshay
thanks a lot for quick revert, i was able to install talib on my mac. although had initial hiccups due to environment differences.
One more thing i was not able to achieve is activating the quantra_py env, although it lists in my conda envs.
see the error log below, seems there are lot of conflicts in packages, i am currently using the anaconda3 env on my mac.
Last login: Sun Mar 3 10:58:38 on ttys001
(base) jaypitale@jays-air ~ % conda env create -f https://quantra.quantinsti.com/downloads/general/environment.yml
Collecting package metadata (repodata.json): done
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
Solving environment:
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed \
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package numpy conflicts for:
pandas==1.4.4 -> numpy[version='>=1.19.5,<2.0a0|>=1.21.6,<2.0a0|>=1.21.5,<2.0a0']
scipy==1.7.0 -> numpy[version='>=1.19.5,<2.0a0']
ta-lib==0.4.19 -> numpy[version='>=1.21.6,<2.0a0']
scikit-learn==0.24.2 -> scipy -> numpy[version='>=1.19,<1.23|>=1.19,<1.25.0|>=1.19,<1.26.0|>=1.19.2,<2.0a0|>=1.19.4,<2.0a0|>=1.20.3,<1.23|>=1.20.3,<1.25|>=1.20.3,<1.26|>=1.20.3,<1.27|>=1.21.6,<1.27|>=1.21.6,<1.28|>=1.22.4,<1.28|>=1.26.3,<1.28|>=1.26.3,<2.0a0|>=1.22.4,<2.0a0|>=1.23.5,<1.28|>=1.23.5,<2.0a0|>=1.26.0,<1.28|>=1.26.0,<2.0a0|>=1.21.6,<2.0a0|>=1.23.5,<1.27|>=1.20.3,<2.0a0|>=1.21.6,<1.26|>=1.23.4,<1.26|>=1.23.4,<2.0a0|>=1.21.6,<1.25|>=1.21.5,<2.0a0|>=1.21.6,<1.23|>=1.21.4,<2.0a0|>=1.26.2,<1.28|>=1.21.5,<1.28|>=1.21,<1.27.0|>=1.23,<1.27.0|>=1.19.5,<1.27.0|>=1.23,<1.26.0|>=1.21,<1.26.0|>=1.21,<1.25.0|>=1.21,<1.23|>=1.19.5,<1.23.0|>=1.21.2,<1.23.0']
scikit-learn==0.24.2 -> numpy[version='>=1.19.5,<2.0a0']
pandas==1.4.4 -> bottleneck[version='>=1.3.1'] -> numpy[version='>=1.20.3,<2.0a0|>=1.22.4,<2.0a0|>=1.23.5,<2.0a0|>=1.26.4,<2.0a0|>=1.26.0,<2.0a0|>=1.23.4,<2.0a0|>=1.21.3,<2.0a0|>=1.22.3,<2.0a0|>=1.21.2,<2.0a0|>=1.26.3,<2.0a0|>=1.26.2,<2.0a0|>=1.21.4,<2.0a0']
numba==0.53.1 -> numpy[version='>=1.19.5,<1.21.0a0']
numpy==1.19.5
Package libffi conflicts for:
pandas==1.4.4 -> python[version='>=3.10,<3.11.0a0'] -> libffi[version='>=3.2.1,<3.3.0a0|>=3.3,<3.4.0a0|>=3.3,<4.0a0|>=3.4,<3.5|>=3.4,<4.0a0|>=3.4.2,<3.5.0a0']
scikit-learn==0.24.2 -> python[version='>=3.8,<3.9.0a0'] -> libffi[version='>=3.2.1,<3.3.0a0|>=3.3,<3.4.0a0|>=3.4,<4.0a0|>=3.4.2,<3.5.0a0|>=3.4,<3.5|>=3.3,<4.0a0']
numpy==1.19.5 -> python[version='>=3.9,<3.10.0a0'] -> libffi[version='>=3.2.1,<3.3.0a0|>=3.3,<3.4.0a0|>=3.4,<4.0a0|>=3.4.2,<3.5.0a0|>=3.4,<3.5|>=3.3,<4.0a0']
pip -> python[version='>=3.7'] -> libffi[version='>=3.2.1,<3.3.0a0|>=3.3,<3.4.0a0|>=3.4,<4.0a0|>=3.4.2,<3.5.0a0|>
Hi Jay,
To resolve this, I would suggest you remove Anaconda's current version (basically do a clean uninstall) and install the following version.
Anaconda3-2022.05-MacOSX-x86_64.pkg
After this, you can retry creating the environment and it should work.