Problem
尝试用 pip
在命令行安装 hdbscan
时,发生如下报错
pip install hdbscan
...
Building wheels for collected packages: hdbscan
Building wheel for hdbscan (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\administrator\.conda\envs\cluster\python.exe' 'c:\users\administrator\.conda\envs\cluster\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\ADMINI~1\AppData\Local\Temp\tmpth7v3gf4'
cwd: C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-4f2tqlz5\hdbscan_1e92e8f5b6024d1cb14f77178788926a
Complete output (37 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\hdbscan
copying hdbscan\hdbscan_.py -> build\lib.win-amd64-3.5\hdbscan
copying hdbscan\plots.py -> build\lib.win-amd64-3.5\hdbscan
copying hdbscan\prediction.py -> build\lib.win-amd64-3.5\hdbscan
copying hdbscan\robust_single_linkage_.py -> build\lib.win-amd64-3.5\hdbscan
copying hdbscan\validity.py -> build\lib.win-amd64-3.5\hdbscan
copying hdbscan\__init__.py -> build\lib.win-amd64-3.5\hdbscan
creating build\lib.win-amd64-3.5\hdbscan\tests
copying hdbscan\tests\test_hdbscan.py -> build\lib.win-amd64-3.5\hdbscan\tests
copying hdbscan\tests\test_rsl.py -> build\lib.win-amd64-3.5\hdbscan\tests
copying hdbscan\tests\__init__.py -> build\lib.win-amd64-3.5\hdbscan\tests
running build_ext
cythoning hdbscan/_hdbscan_tree.pyx to hdbscan\_hdbscan_tree.c
cythoning hdbscan/_hdbscan_linkage.pyx to hdbscan\_hdbscan_linkage.c
cythoning hdbscan/_hdbscan_boruvka.pyx to hdbscan\_hdbscan_boruvka.c
cythoning hdbscan/_hdbscan_reachability.pyx to hdbscan\_hdbscan_reachability.c
cythoning hdbscan/_prediction_utils.pyx to hdbscan\_prediction_utils.c
cythoning hdbscan/dist_metrics.pyx to hdbscan\dist_metrics.c
building 'hdbscan._hdbscan_tree' extension
C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-env-duca94o_\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\ADMINI~1\AppData\Local\Temp\pip-install-4f2tqlz5\hdbscan_1e92e8f5b6024d1cb14f77178788926a\hdbscan\_hdbscan_tree.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-env-duca94o_\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\ADMINI~1\AppData\Local\Temp\pip-install-4f2tqlz5\hdbscan_1e92e8f5b6024d1cb14f77178788926a\hdbscan\_hdbscan_linkage.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-env-duca94o_\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\ADMINI~1\AppData\Local\Temp\pip-install-4f2tqlz5\hdbscan_1e92e8f5b6024d1cb14f77178788926a\hdbscan\_hdbscan_boruvka.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-env-duca94o_\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\ADMINI~1\AppData\Local\Temp\pip-install-4f2tqlz5\hdbscan_1e92e8f5b6024d1cb14f77178788926a\hdbscan\_hdbscan_reachability.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-env-duca94o_\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\ADMINI~1\AppData\Local\Temp\pip-install-4f2tqlz5\hdbscan_1e92e8f5b6024d1cb14f77178788926a\hdbscan\_prediction_utils.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-env-duca94o_\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\ADMINI~1\AppData\Local\Temp\pip-install-4f2tqlz5\hdbscan_1e92e8f5b6024d1cb14f77178788926a\hdbscan\dist_metrics.pxd
tree = Parsing.p_module(s, pxd, full_module_name)
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/
----------------------------------------
ERROR: Failed building wheel for hdbscan
Failed to build hdbscan
ERROR: Could not build wheels for hdbscan which use PEP 517 and cannot be installed directly
Solvement
使用 conda
重新安装 hdbscan
- 打开 anaconda Cloud 官网
- 在搜索栏输入 hdbscan,选择一个下载次数最多,或者平台支持最广的版本 (2020/12/16 更新: 建议选择第二个下载源, 即 zeus1942/hdbscan, 作者在使用第一个时遇到了一些问题)
- 任选一个安装命令执行即可
最后显示安装成功
Downloading and Extracting Packages
intel-openmp-2020.3 | 2.0 MB | ############################################################################ | 100%
scipy-1.1.0 | 10.3 MB | ############################################################################ | 100%
mkl-2018.0.3 | 112.6 MB | ############################################################################ | 100%
certifi-2018.8.24 | 139 KB | ############################################################################ | 100%
scikit-learn-0.20.0 | 3.8 MB | ############################################################################ | 100%
numpy-1.14.2 | 2.9 MB | ############################################################################ | 100%
hdbscan-0.8.18 | 494 KB | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(Cluster) C:\Users\Administrator>