gpt4 book ai didi

python - 如何解决安装基于 pyproject.toml 的项目所需的错误 : Could not build wheels for hdbscan,

转载 作者:行者123 更新时间:2023-12-05 03:20:22 30 4
gpt4 key购买 nike

我正在尝试安装 bertopic,但出现此错误:

 pip install bertopic



Collecting bertopic
> Using cached bertopic-0.11.0-py2.py3-none-any.whl (76 kB)
> Collecting hdbscan>=0.8.28
> Using cached hdbscan-0.8.28.tar.gz (5.2 MB)
> Installing build dependencies: started
> Installing build dependencies: finished with status 'done'
> Getting requirements to build wheel: started
> Getting requirements to build wheel: finished with status 'done'
> Preparing metadata (pyproject.toml): started
> Preparing metadata (pyproject.toml): finished with status 'done'
> Requirement already satisfied: tqdm>=4.41.1 in c:\users\martin kunth\anaconda3\lib\site-packages (from bertopic) (4.62.3)
> Collecting umap-learn>=0.5.0
> Using cached umap_learn-0.5.3-py3-none-any.whl
> Requirement already satisfied: scikit-learn>=0.22.2.post1 in c:\users\martin kunth\anaconda3\lib\site-packages (from bertopic)
>
(0.24.2)
>

Requirement already satisfied: numpy>=1.20.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from bertopic)
> (1.20.3)
> Collecting plotly>=4.7.0
> Using cached plotly-5.9.0-py2.py3-none-any.whl (15.2 MB)
> Requirement already satisfied: pandas>=1.1.5 in c:\users\martin kunth\anaconda3\lib\site-packages (from bertopic)
> (1.3.4)
> Collecting pyyaml<6.0
> Note: you may need to restart the kernel to use updated packages.
> error: subprocess-exited-with-error


>

>

Building wheel for hdbscan (pyproject.toml) did not run successfully.
> exit code: 1
>
> [40 lines of output]
> running bdist_wheel
> running build
> running build_py
> creating build
> creating build\lib.win-amd64-cpython-39
> creating build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\flat.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\hdbscan_.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\plots.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\prediction.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\robust_single_linkage_.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\validity.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\__init__.py -> build\lib.win-amd64-cpython-39\hdbscan
> creating build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_flat.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_hdbscan.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_prediction_utils.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_rsl.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\__init__.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> running build_ext
> cythoning hdbscan/_hdbscan_tree.pyx to hdbscan\_hdbscan_tree.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-a026odlf\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-2r29izqw\hdbscan_215c105aa4414866a73cfee4bf64c07a\hdbscan\_hdbscan_tree.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_hdbscan_linkage.pyx to hdbscan\_hdbscan_linkage.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-a026odlf\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-2r29izqw\hdbscan_215c105aa4414866a73cfee4bf64c07a\hdbscan\_hdbscan_linkage.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_hdbscan_boruvka.pyx to hdbscan\_hdbscan_boruvka.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-a026odlf\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-2r29izqw\hdbscan_215c105aa4414866a73cfee4bf64c07a\hdbscan\_hdbscan_boruvka.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_hdbscan_reachability.pyx to hdbscan\_hdbscan_reachability.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-a026odlf\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-2r29izqw\hdbscan_215c105aa4414866a73cfee4bf64c07a\hdbscan\_hdbscan_reachability.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_prediction_utils.pyx to hdbscan\_prediction_utils.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-a026odlf\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-2r29izqw\hdbscan_215c105aa4414866a73cfee4bf64c07a\hdbscan\_prediction_utils.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/dist_metrics.pyx to hdbscan\dist_metrics.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-a026odlf\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-2r29izqw\hdbscan_215c105aa4414866a73cfee4bf64c07a\hdbscan\dist_metrics.pxd
> tree = Parsing.p_module(s, pxd, full_module_name)
> Using cached PyYAML-5.4.1-cp39-cp39-win_amd64.whl (213 kB)
> Collecting sentence-transformers>=0.4.1
> Using cached sentence_transformers-2.2.2-py3-none-any.whl
> Requirement already satisfied: scipy>=1.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan>=0.8.28->bertopic)
> (1.7.1)
> Requirement already satisfied: cython>=0.27 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan>=0.8.28->bertopic)
> (0.29.28)
> Requirement already satisfied: joblib>=1.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan>=0.8.28->bertopic)
> (1.1.0)
> Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> pandas>=1.1.5->bertopic) (2.8.2)
> Requirement already satisfied: pytz>=2017.3 in c:\users\martin kunth\anaconda3\lib\site-packages (from pandas>=1.1.5->bertopic)
> (2021.3)
> Collecting tenacity>=6.2.0
> Using cached tenacity-8.0.1-py3-none-any.whl (24 kB)
> Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> scikit-learn>=0.22.2.post1->bertopic) (2.2.0)
> Collecting torch>=1.6.0
> Using cached torch-1.12.0-cp39-cp39-win_amd64.whl (161.8 MB)
> Collecting sentencepiece
> Using cached sentencepiece-0.1.96-cp39-cp39-win_amd64.whl (1.1 MB)
> Requirement already satisfied: nltk in c:\users\martin kunth\anaconda3\lib\site-packages (from
> sentence-transformers>=0.4.1->bertopic) (3.6.5)
> Collecting torchvision
> Using cached torchvision-0.13.0-cp39-cp39-win_amd64.whl (1.1 MB)
> Collecting transformers<5.0.0,>=4.6.0
> Using cached transformers-4.21.0-py3-none-any.whl (4.7 MB)
> Collecting huggingface-hub>=0.4.0
> Using cached huggingface_hub-0.8.1-py3-none-any.whl (101 kB)
> Requirement already satisfied: colorama in c:\users\martin kunth\anaconda3\lib\site-packages (from tqdm>=4.41.1->bertopic)
> (0.4.4)
> Collecting pynndescent>=0.5
> Using cached pynndescent-0.5.7-py3-none-any.whl
> Requirement already satisfied: numba>=0.49 in c:\users\martin kunth\anaconda3\lib\site-packages (from umap-learn>=0.5.0->bertopic)
> (0.54.1)
> Requirement already satisfied: filelock in c:\users\martin kunth\anaconda3\lib\site-packages (from
> huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic)
> (3.3.1)
> Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic)
> (3.10.0.2)
> Requirement already satisfied: requests in c:\users\martin kunth\anaconda3\lib\site-packages (from
> huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic)
> (2.27.1)
> Requirement already satisfied: packaging>=20.9 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic) (21.0)
> Requirement already satisfied: setuptools in c:\users\martin kunth\anaconda3\lib\site-packages (from
> numba>=0.49->umap-learn>=0.5.0->bertopic) (58.0.4)
> Requirement already satisfied: llvmlite<0.38,>=0.37.0rc1 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> numba>=0.49->umap-learn>=0.5.0->bertopic) (0.37.0)
> Requirement already satisfied: six>=1.5 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> python-dateutil>=2.7.3->pandas>=1.1.5->bertopic) (1.16.0)
> Requirement already satisfied: regex!=2019.12.17 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> transformers<5.0.0,>=4.6.0->sentence-transformers>=0.4.1->bertopic)
> (2021.8.3)
> Collecting tokenizers!=0.11.3,<0.13,>=0.11.1
> Using cached tokenizers-0.12.1-cp39-cp39-win_amd64.whl (3.3 MB)
> Requirement already satisfied: click in c:\users\martin kunth\anaconda3\lib\site-packages (from
> nltk->sentence-transformers>=0.4.1->bertopic) (7.1.2)
> Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> torchvision->sentence-transformers>=0.4.1->bertopic) (8.4.0)
> Requirement already satisfied: pyparsing>=2.0.2 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> packaging>=20.9->huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic) (3.0.4)
> Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> requests->huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic)
> (2.0.4)
> Requirement already satisfied: certifi>=2017.4.17 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> requests->huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic)
> (2021.10.8)
> Requirement already satisfied: idna<4,>=2.5 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> requests->huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic)
> (3.2)
> Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> requests->huggingface-hub>=0.4.0->sentence-transformers>=0.4.1->bertopic)
> (1.26.7)
> Building wheels for collected packages: hdbscan
> Building wheel for hdbscan (pyproject.toml): started
> Building wheel for hdbscan (pyproject.toml): finished with status 'error'
> Failed to build hdbscan
> building 'hdbscan._hdbscan_tree' 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 hdbscan
> ERROR: Could not build wheels for hdbscan, which is required to install pyproject.toml-based projects

我安装了 Microsoft Visual C++ 2015-2019 Redistributable (x86) - 14.32.31332。我也升级了我的 pip pip-22.2.1

我尝试安装 hdbscan,但我也遇到了错误:

pip install hdbscan


> Collecting hdbscan
> Using cached hdbscan-0.8.28.tar.gz (5.2 MB)
> Installing build dependencies: started
> Installing build dependencies: finished with status 'done'
> Getting requirements to build wheel: started
> Getting requirements to build wheel: finished with status 'done'
> Preparing metadata (pyproject.toml): started
> Preparing metadata (pyproject.toml): finished with status 'done'
> Requirement already satisfied: scikit-learn>=0.20 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan)
> (0.24.2)
> Requirement already satisfied: joblib>=1.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan) (1.1.0)
> Requirement already satisfied: scipy>=1.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan) (1.7.1)
> Requirement already satisfied: numpy>=1.20 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan) (1.20.3)
> Requirement already satisfied: cython>=0.27 in c:\users\martin kunth\anaconda3\lib\site-packages (from hdbscan) (0.29.28)
> Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\martin kunth\anaconda3\lib\site-packages (from
> scikit-learn>=0.20->hdbscan) (2.2.0)
> Building wheels for collected packages: hdbscan
> Building wheel for hdbscan (pyproject.toml): started
> Building wheel for hdbscan (pyproject.toml): finished with status 'error'
> Failed to build hdbscan
> Note: you may need to restart the kernel to use updated packages.
> error: subprocess-exited-with-error
>
> Building wheel for hdbscan (pyproject.toml) did not run successfully.
> exit code: 1
>
> [40 lines of output]
> running bdist_wheel
> running build
> running build_py
> creating build
> creating build\lib.win-amd64-cpython-39
> creating build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\flat.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\hdbscan_.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\plots.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\prediction.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\robust_single_linkage_.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\validity.py -> build\lib.win-amd64-cpython-39\hdbscan
> copying hdbscan\__init__.py -> build\lib.win-amd64-cpython-39\hdbscan
> creating build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_flat.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_hdbscan.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_prediction_utils.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\test_rsl.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> copying hdbscan\tests\__init__.py -> build\lib.win-amd64-cpython-39\hdbscan\tests
> running build_ext
> cythoning hdbscan/_hdbscan_tree.pyx to hdbscan\_hdbscan_tree.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-cn18pe9m\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-k2_bwg0z\hdbscan_9b50b30873a2465bb3156fb27111abf2\hdbscan\_hdbscan_tree.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_hdbscan_linkage.pyx to hdbscan\_hdbscan_linkage.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-cn18pe9m\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-k2_bwg0z\hdbscan_9b50b30873a2465bb3156fb27111abf2\hdbscan\_hdbscan_linkage.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_hdbscan_boruvka.pyx to hdbscan\_hdbscan_boruvka.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-cn18pe9m\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-k2_bwg0z\hdbscan_9b50b30873a2465bb3156fb27111abf2\hdbscan\_hdbscan_boruvka.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_hdbscan_reachability.pyx to hdbscan\_hdbscan_reachability.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-cn18pe9m\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-k2_bwg0z\hdbscan_9b50b30873a2465bb3156fb27111abf2\hdbscan\_hdbscan_reachability.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/_prediction_utils.pyx to hdbscan\_prediction_utils.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-cn18pe9m\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-k2_bwg0z\hdbscan_9b50b30873a2465bb3156fb27111abf2\hdbscan\_prediction_utils.pyx
> tree = Parsing.p_module(s, pxd, full_module_name)
> cythoning hdbscan/dist_metrics.pyx to hdbscan\dist_metrics.c
> C:\Users\Martin Kunth\AppData\Local\Temp\pip-build-env-cn18pe9m\overlay\Lib\site-packages\Cython\Compiler\Main.py:369:
> FutureWarning: Cython directive 'language_level' not set, using 2 for
> now (Py2). This will change in a later release! File: C:\Users\Martin
> Kunth\AppData\Local\Temp\pip-install-k2_bwg0z\hdbscan_9b50b30873a2465bb3156fb27111abf2\hdbscan\dist_metrics.pxd
> tree = Parsing.p_module(s, pxd, full_module_name)
> building 'hdbscan._hdbscan_tree' 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 hdbscan
> ERROR: Could not build wheels for hdbscan, which is required to install pyproject.toml-based projects

我现在不知道如何进行。任何帮助,将不胜感激。非常感谢。

最佳答案

你可以通过安装python-dev来解决这个问题

python3 -m pip install python-dev-tools --user --upgrade

此外,尝试使用 conda install 而不是 pip

conda install -c conda-forge hdbscan

此外,请确保安装 Microsoft Visual C++

关于python - 如何解决安装基于 pyproject.toml 的项目所需的错误 : Could not build wheels for hdbscan,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73171473/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com