英文:
Failed building wheel for TA-Lib in VS Code without Anaconda on Windows 10
问题
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?
<details>
<summary>英文:</summary>
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?
</details>
# 答案1
**得分**: 0
问题的根本在于已安装的visual-cpp-build-tools。
我进行了许多实验和调查,包括msbuild。我几乎达到了目标。
然后我发现了一个带有预编译wheels的网站。 =>
["https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib"][1]
来自文章:
["https://blog.quantinsti.com/install-ta-lib-python/"][2]
所以,从在VS Code中激活的venv中,最终解决方案的语法:
pip install TA_Lib-0.4.24-cp310-cp310-win_amd64.whl
请注意,文件名与上述网站中提到的Python和操作系统版本相对应。
它有效!
<details>
<summary>英文:</summary>
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"][1]
from the article:
["https://blog.quantinsti.com/install-ta-lib-python/"][2]
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!
[1]: https://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib
[2]: https://blog.quantinsti.com/install-ta-lib-python/
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论