I'm trying to install TA-Lib in VS Code without conda.
In a new terminal VSC and venv I execute:
(trading) D:\CWD>python -m pip install TA-Lib
and getting the output:
Collecting TA-Lib
Using cached TA-Lib-0.4.26.tar.gz (272 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Collecting numpy (from TA-Lib)
Using cached numpy-1.25.0-cp310-cp310-win_amd64.whl (15.0 MB)
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
╰─> [20 lines of output]
<string>:77: UserWarning: Cannot find ta-lib library, installation may fail.
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\talib
copying talib\abstract.py -> build\lib.win-amd64-cpython-310\talib
copying talib\deprecated.py -> build\lib.win-amd64-cpython-310\talib
copying talib\stream.py -> build\lib.win-amd64-cpython-310\talib
copying talib\test_abstract.py -> build\lib.win-amd64-cpython-310\talib
copying talib\test_data.py -> build\lib.win-amd64-cpython-310\talib
copying talib\test_func.py -> build\lib.win-amd64-cpython-310\talib
copying talib\test_pandas.py -> build\lib.win-amd64-cpython-310\talib
copying talib\test_polars.py -> build\lib.win-amd64-cpython-310\talib
copying talib\test_stream.py -> build\lib.win-amd64-cpython-310\talib
copying talib\__init__.py -> build\lib.win-amd64-cpython-310\talib
running build_ext
building 'talib._ta_lib' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[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
Remarks: 1) It's not a problem to install talib with conda. 2) I downloaded required MS C++ package as required. It's seen in Control panel. But probably some settings required for VSC in order to see it. Looks like it's the key point of the problem.
Question: How to build wheels for TA-Lib without conda and install the TA-Lib?
The root of the problem is in the installed visual-cpp-build-tools. I’ve made a lot of experiments and investigations, including msbuild. I almost reached the goal.
Then I discovered the site with precompiled wheels. => "https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib"
from the article: "https://blog.quantinsti.com/install-ta-lib-python/"
So, from activated venv in VS Code,the syntax of final solution:
pip install TA_Lib-0.4.24-cp310-cp310-win_amd64.whl
Notice that the file name corresponds to your python and OS versions from the mentioned above site.
It works!