Solved ERROR: Could not build wheels for hdbscan which use PEP 517 and cannot be installed directly

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

  1. 打开 anaconda Cloud 官网
  2. 在搜索栏输入 hdbscan,选择一个下载次数最多,或者平台支持最广的版本 (2020/12/16 更新: 建议选择第二个下载源, 即 zeus1942/hdbscan, 作者在使用第一个时遇到了一些问题)
    在这里插入图片描述
  3. 任选一个安装命令执行即可
    在这里插入图片描述

最后显示安装成功

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>
  • 11
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

江湖留名

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值