-
Notifications
You must be signed in to change notification settings - Fork 759
Description
First off, thank you for this library, it works great and it's definitely fast.
I've run into the issue below for a while now when including hnswlib as a install_requires dependency in an empty virtual environment. Currently, the hnswlib install is falling back to a python setup.py install build but per the deprecation message below that will break with pip 21.0.
DEPRECATION: hnswlib was installed using the legacy 'setup.py install' method, because a wheel could not be built for it. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at pypa/pip#8368.
This is the stacktrace when hnswlib is a dependency via install_requires.
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-8sme64a_/hnswlib_db0256fc916d446cb5402165d7531712/setup.py", line 116, in
zip_safe=False,
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/setuptools/init.py", line 143, in setup
return distutils.core.setup(**attrs)
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 78, in run
build_ext.run(self)
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/tmp/pip-install-8sme64a/hnswlib_db0256fc916d446cb5402165d7531712/setup.py", line 89, in build_extensions
import numpy as np
ModuleNotFoundError: No module named 'numpy'
I cloned the project locally, ran python setup.py bdist_wheel and received a similar error with an empty environment.
Adding the following line to hnswlib/python_bindings/setup.py after install_requires solves the issue in my case for both instances mentioned above.
setup_requires=['pybind11>=2.0', 'numpy'],
Please consider making this change to support environments where numpy/pybind11 isn't already installed.