2

我正在尝试在运行 Windows 10 并已安装 Python 3.6 的 PC 上安装 hdbscan。

我的第一次尝试失败了:

(base) C:\WINDOWS\system32>pip install hdbscan --user
Collecting hdbscan
  Using cached https://files.pythonhosted.org/packages/10/7c/1401ec61b0e7392287e045b6913206cfff050b65d869c19f7ec0f5626487/hdbscan-0.8.22.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: scikit-learn>=0.17 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from hdbscan) (0.19.1)
Requirement already satisfied: joblib in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from hdbscan) (0.13.2)
Requirement already satisfied: numpy>=1.16.0 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from hdbscan) (1.17.2)
Requirement already satisfied: cython>=0.27 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from hdbscan) (0.29.10)
Requirement already satisfied: scipy>=0.9 in c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages (from hdbscan) (1.2.2)
Building wheels for collected packages: hdbscan
  Building wheel for hdbscan (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\python.exe' 'c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\Alienware\AppData\Local\Temp\tmp8ir950og'
       cwd: C:\Users\Alienware\AppData\Local\Temp\pip-install-hxifwoph\hdbscan
  Complete output (67 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\hdbscan
  copying hdbscan\hdbscan_.py -> build\lib.win-amd64-3.6\hdbscan
  copying hdbscan\plots.py -> build\lib.win-amd64-3.6\hdbscan
  copying hdbscan\prediction.py -> build\lib.win-amd64-3.6\hdbscan
  copying hdbscan\robust_single_linkage_.py -> build\lib.win-amd64-3.6\hdbscan
  copying hdbscan\validity.py -> build\lib.win-amd64-3.6\hdbscan
  copying hdbscan\__init__.py -> build\lib.win-amd64-3.6\hdbscan
  creating build\lib.win-amd64-3.6\hdbscan\tests
  copying hdbscan\tests\test_hdbscan.py -> build\lib.win-amd64-3.6\hdbscan\tests
  copying hdbscan\tests\test_rsl.py -> build\lib.win-amd64-3.6\hdbscan\tests
  copying hdbscan\tests\__init__.py -> build\lib.win-amd64-3.6\hdbscan\tests
  running build_ext
  Traceback (most recent call last):
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 207, in <module>
      main()
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 197, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 141, in build_wheel
      metadata_directory)
    File "C:\Users\Alienware\AppData\Local\Temp\pip-build-env-n2heecpm\overlay\Lib\site-packages\setuptools\build_meta.py", line 209, in build_wheel
      wheel_directory, config_settings)
    File "C:\Users\Alienware\AppData\Local\Temp\pip-build-env-n2heecpm\overlay\Lib\site-packages\setuptools\build_meta.py", line 194, in _build_with_temp_dir
      self.run_setup()
    File "C:\Users\Alienware\AppData\Local\Temp\pip-build-env-n2heecpm\overlay\Lib\site-packages\setuptools\build_meta.py", line 237, in run_setup
      self).run_setup(setup_script=setup_script)
    File "C:\Users\Alienware\AppData\Local\Temp\pip-build-env-n2heecpm\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 96, in <module>
      setup(**configuration)
    File "C:\Users\Alienware\AppData\Local\Temp\pip-build-env-n2heecpm\overlay\Lib\site-packages\setuptools\__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "C:\Users\Alienware\AppData\Local\Temp\pip-build-env-n2heecpm\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\dist.py", line 974, in run_command
      cmd_obj.run()
    File "setup.py", line 26, in run
      build_ext.run(self)
    File "C:\Users\Alienware\AppData\Local\Temp\pip-build-env-n2heecpm\overlay\Lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
      _build_ext.build_ext.run(self)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\command\build_ext.py", line 308, in run
      force=self.force)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\ccompiler.py", line 1031, in new_compiler
      return klass(None, dry_run, force)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\cygwinccompiler.py", line 285, in __init__
      CygwinCCompiler.__init__ (self, verbose, dry_run, force)
    File "c:\program files (x86)\microsoft visual studio\shared\anaconda3_64\lib\distutils\cygwinccompiler.py", line 129, in __init__
      if self.ld_version >= "2.10.90":
  TypeError: '>=' not supported between instances of 'NoneType' and 'str'
  ----------------------------------------
  ERROR: Failed building wheel for hdbscan
  Running setup.py clean for hdbscan
Failed to build hdbscan
ERROR: Could not build wheels for hdbscan which use PEP 517 and cannot be installed directly

您了解为什么系统无法为 hdbscan 构建轮子吗?

有什么我可以做的吗?此时有哪些替代方案?

我尝试在没有二进制文件的情况下安装 hdbscan 但再次失败:

(base) C:\WINDOWS\system32>pip install --upgrade --no-binary hdbscan
ERROR: You must give at least one requirement to install (see "pip help install")

(base) C:\WINDOWS\system32>pip list outdated
Package                            Version
---------------------------------- ---------------------
matplotlib                         2.2.2
scipy                              1.1.0
numpy                              1.14.3
absl-py                            0.7.1
alabaster                          0.7.10
anaconda-client                    1.6.14
anaconda-navigator                 1.8.7
anaconda-project                   0.8.2
arviz                              0.4.1
asn1crypto                         0.24.0
aspy.yaml                          1.2.0
astor                              0.7.1
astroid                            1.6.3
astropy                            3.0.2
astunparse                         1.6.2
attrs                              18.1.0
autograd                           1.2
Babel                              2.5.3
backcall                           0.1.0
backports.shutil-get-terminal-size 1.0.0
beautifulsoup4                     4.6.0
bitarray                           0.8.1
bkcharts                           0.2
blaze                              0.11.3
bleach                             1.5.0
blis                               0.2.4
bokeh                              0.12.16
boto                               2.48.0
boto3                              1.9.130
botocore                           1.12.130
Bottleneck                         1.2.1
brewer2mpl                         1.4.1
bs4                                0.0.1
bz2file                            0.98
certifi                            2018.4.16
cffi                               1.11.5
cfgv                               1.6.0
cftime                             1.0.3.4
chardet                            3.0.4
click                              6.7
cloudpickle                        1.2.1
clyent                             1.2.2
colorama                           0.3.9
colour                             0.1.5
comtypes                           1.1.4
conda                              4.6.8
conda-build                        3.10.5
conda-verify                       2.0.0
contextlib2                        0.5.5
convertdate                        2.1.3
cryptography                       2.2.2
cycler                             0.10.0
cymem                              2.0.2
Cython                             0.29.10
cytoolz                            0.9.0.1
d2l                                0.9.2
dask                               0.17.5
datashape                          0.5.4
decorator                          4.3.0
dill                               0.3.0
distributed                        1.21.8
Django                             2.2.2
dltk                               0.2.1
docutils                           0.14
el-core-news-md                    2.1.0
el-core-news-sm                    2.1.0
embedder                           0.1
en-core-web-md                     2.1.0
entrypoints                        0.2.3
ephem                              3.7.6.0
et-xmlfile                         1.0.1
fastcache                          1.0.2
fastdtw                            0.3.2
fasttext                           0.8.3
fbprophet                          0.1.post1
filelock                           3.0.4
fix-yahoo-finance                  0.0.22
Flask                              1.0.2
Flask-Cors                         3.0.4
future                             0.17.1
gast                               0.2.2
gensim                             3.7.1
geojson                            2.4.1
gevent                             1.3.0
ggplot                             0.11.5
glob2                              0.6
google-pasta                       0.1.4
googleapis-common-protos           1.6.0
graphviz                           0.8.4
greenlet                           0.4.13
grpcio                             1.19.0
gym                                0.14.0
h5py                               2.7.1
heapdict                           1.0.0
hmmlearn                           0.2.2
holidays                           0.9.10
html5lib                           0.9999999
hyperopt                           0.1.1
identify                           1.4.1
idna                               2.6
image                              1.5.27
imageio                            2.3.0
imagesize                          1.0.0
importlib-metadata                 0.9
importlib-resources                1.0.2
inflection                         0.3.1
ipykernel                          4.8.2
ipython                            6.4.0
ipython-genutils                   0.2.0
ipywidgets                         7.2.1
isort                              4.3.4
iterative-stratification           0.1.6
itsdangerous                       0.24
jdcal                              1.4
jedi                               0.12.0
Jinja2                             2.10
jmespath                           0.9.4
joblib                             0.13.2
json-tricks                        3.12.2
jsonschema                         2.6.0
jupyter                            1.0.0
jupyter-client                     5.2.3
jupyter-console                    5.2.0
jupyter-contrib-core               0.3.3
jupyter-contrib-nbextensions       0.5.1
jupyter-core                       4.4.0
jupyter-highlight-selected-word    0.2.0
jupyter-latex-envs                 1.4.6
jupyter-nbextensions-configurator  0.4.1
jupyterlab                         0.32.1
jupyterlab-launcher                0.10.5
Keras                              2.2.5
Keras-Applications                 1.0.8
Keras-Preprocessing                1.1.0
keras-rl                           0.4.2
kiwisolver                         1.0.1
lazy-object-proxy                  1.3.1
llvmlite                           0.23.1
locket                             0.2.0
lunardate                          0.2.0
lxml                               4.4.1
Markdown                           3.1
MarkupSafe                         1.0
matplotlib                         3.1.1
mccabe                             0.6.1
menuinst                           1.4.14
mistune                            0.8.3
mkl-fft                            1.0.0
mkl-random                         1.0.1
mock                               2.0.0
more-itertools                     4.1.0
mpld3                              0.3
mpmath                             1.0.0
msgpack                            0.6.1
msgpack-python                     0.5.6
multipledispatch                   0.5.0
multitasking                       0.0.7
murmurhash                         1.0.2
mxnet-cu101                        1.5.0
navigator-updater                  0.2.1
nbconvert                          5.3.1
nbformat                           4.4.0
netCDF4                            1.5.1.2
networkx                           2.1
neuralcoref                        4.0
nltk                               3.3
NNI                                0.1.0
nodeenv                            1.3.3
nose                               1.3.7
notebook                           5.5.0
numba                              0.38.0
numexpr                            2.6.5
numpy                              1.17.2
numpydoc                           0.8.0
odo                                0.5.1
olefile                            0.45.1
opencv-python                      4.1.1.26
openpyxl                           2.5.3
packaging                          17.1
pandas                             0.24.2
pandas-datareader                  0.7.0
pandocfilters                      1.4.2
parso                              0.2.0
partd                              0.3.8
path.py                            11.0.1
pathlib2                           2.3.2
patsy                              0.5.0
pbr                                5.1.3
pep8                               1.7.1
pickleshare                        0.7.4
Pillow                             5.1.0
pip                                19.2.3
pixiedust                          1.1.13
pkginfo                            1.4.2
plac                               0.9.6
plotly                             4.0.0
pluggy                             0.6.0
ply                                3.11
pmdarima                           1.2.1
pre-commit                         1.15.1
preshed                            2.0.1
promise                            2.2.1
prompt-toolkit                     1.0.15
protobuf                           3.7.1
psutil                             5.4.5
py                                 1.5.3
py-translate                       1.0.3
pybind11                           2.2.4
pycodestyle                        2.4.0
pycosat                            0.6.3
pycparser                          2.18
pycrypto                           2.6.1
pycurl                             7.43.0.1
pydot                              1.4.1
pydotplus                          2.0.2
pyflakes                           1.6.0
pyglet                             1.3.2
Pygments                           2.2.0
pylint                             1.8.4
pymongo                            3.7.1
pyodbc                             4.0.23
pyOpenSSL                          18.0.0
pyparsing                          2.2.0
PyProcessMacro                     1.0.0
pyreadstat                         0.2.1
PySocks                            1.6.8
pystan                             2.19.0.0
pytest                             3.5.1
pytest-arraydiff                   0.2
pytest-astropy                     0.3.0
pytest-doctestplus                 0.1.3
pytest-openfiles                   0.3.0
pytest-remotedata                  0.2.1
python-dateutil                    2.7.3
pytz                               2018.4
PyWavelets                         0.5.2
pywin32                            223
pywinpty                           0.5.1
PyYAML                             3.12
pyzmq                              17.0.0
QtAwesome                          0.4.4
qtconsole                          4.3.1
QtPy                               1.4.1
Quandl                             3.4.6
regex                              2019.8.19
requests                           2.22.0
retrying                           1.3.3
rope                               0.10.7
ruamel-yaml                        0.15.35
s3transfer                         0.2.0
sacremoses                         0.0.34
scikit-image                       0.15.0
scikit-learn                       0.19.1
scipy                              1.2.2
seaborn                            0.9.0
sec-edgar-downloader               2.2.1
Send2Trash                         1.5.0
sentencepiece                      0.1.83
setuptools                         41.2.0
setuptools-git                     1.2
shap                               0.30.1
simplegeneric                      0.8.1
SimpleITK                          1.2.2
simplejson                         3.16.0
singledispatch                     3.4.0.3
six                                1.11.0
smart-open                         1.8.0
snowballstemmer                    1.2.1
sortedcollections                  0.6.1
sortedcontainers                   1.5.10
spacy                              2.1.3
Sphinx                             1.7.4
sphinxcontrib-websupport           1.0.1
spyder                             3.2.8
SQLAlchemy                         1.2.7
sqlparse                           0.3.0
srsly                              0.0.5
statsmodels                        0.9.0
sympy                              1.1.1
tables                             3.4.3
tb-nightly                         1.14.0a20190301
tblib                              1.3.2
tensorboard                        2.0.0
tensorflow                         2.0.0a0
tensorflow-datasets                1.2.0
tensorflow-estimator               1.13.0
tensorflow-gpu                     1.13.1
tensorflow-metadata                0.14.0
tensorflow-probability             0.6.0
termcolor                          1.1.0
terminado                          0.8.1
testpath                           0.3.1
tf-estimator-nightly               1.14.0.dev2019030115
tfds-nightly                       1.2.0.dev201909050105
Theano                             1.0.4
thinc                              7.0.4
toml                               0.10.0
toolz                              0.9.0
torch                              1.0.1
tornado                            5.0.2
tox                                3.8.6
tqdm                               4.31.1
tradingeconomics                   0.2.953
traitlets                          4.3.2
transformers                       2.0.0
translate                          3.5.0
tsfresh                            0.11.2
tushare                            1.2.39
typing                             3.6.4
unicodecsv                         0.14.1
urllib3                            1.22
virtualenv                         16.4.3
wasabi                             0.2.1
wcwidth                            0.1.7
webencodings                       0.5.1
websocket-client                   0.56.0
Werkzeug                           0.14.1
wheel                              0.31.1
widgetsnbextension                 3.2.1
win-inet-pton                      1.0.1
win-unicode-console                0.5
wincertstore                       0.2
wrapt                              1.10.11
xarray                             0.12.3
xgboost                            0.82
xlrd                               1.1.0
XlsxWriter                         1.0.4
xlwings                            0.11.8
xlwt                               1.3.0
yahoo-finance                      1.4.0
yahoofinancials                    1.5
yfinance                           0.1.45
zict                               0.1.3
zipp                               0.3.3
4

4 回答 4

3

--no-binary选项比看起来更复杂。它需要一个单独的包列表,您不希望对其使用二进制文件:

--no-binary <format_control>
       Do not use binary packages. Can be supplied multiple times, and
       each time adds to the existing value. Accepts either :all: to
       disable all binary packages, :none: to empty the set, or one
       or more package names with commas between them. Note that some
       packages are tricky to compile and may fail to install when this
       option is used on them.

所以你可能想要

> pip install --upgrade --no-binary hdbscan hdbscan
于 2019-10-07T09:14:45.607 回答
1

我在安装 Tensorflow Object Detection API 时遇到了这个错误。

在最后一条指令之后,我忘了在代码末尾加上句号。请检查安装单词后是否缺少任何内容。

# Install the Object Detection API
%%bash
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install . (. dot is necessary)
于 2021-08-04T08:54:29.077 回答
0

我在使用 Ubuntu 18 和 Python3.6 时遇到过类似的问题。我解决了安装以下软件包的问题:

sudo apt-get install python3 python-dev python3-dev \
     build-essential libssl-dev libffi-dev \
     libxml2-dev libxslt1-dev zlib1g-dev \
     python-pip

并使用 --no-binary 选项安装要求

我知道这不是 Windows 用户的复制粘贴解决方案,但也许您也缺少一些开发库?

于 2019-11-05T16:25:54.590 回答
0

是的——将 HDBSCAN 安装到 Windows 机器上有点棘手,因为它依赖于构建工具。好像您是在 Anaconda 环境中安装它,使用以下命令为我解决了这个问题。

conda install -c conda-forge hdbscan
于 2020-07-24T15:38:34.750 回答