'Error when trying to install autodocking Vina

I'm trying to install Autodock Vina with pip command. But when I run the command pip install -U numpy vina: I get a the following error:

Collecting vina
  Using cached vina-1.2.3.tar.gz (95 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [52 lines of output]
      Version found 1.2.3 (from __init__.py)
      running egg_info
      writing vina.egg-info\PKG-INFO
      writing dependency_links to vina.egg-info\dependency_links.txt
      writing requirements to vina.egg-info\requires.txt
      writing top-level names to vina.egg-info\top_level.txt
      Boost library is not installed in this conda environment.
      Traceback (most recent call last):
        File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 346, in <module>
          setup(
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\__init__.py", line 155, in setup
          return distutils.core.setup(**attrs)
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
          return run_commands(dist)
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 163, in run_commands
          dist.run_commands()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
          self.run_command(cmd)
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
          cmd_obj.run()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 299, in run
          self.find_sources()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 306, in find_sources
          mm.run()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 541, in run
          self.add_defaults()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 578, in add_defaults
          sdist.add_defaults(self)
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 228, in add_defaults
          self._add_defaults_ext()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\command\sdist.py", line 311, in _add_defaults_ext
          build_ext = self.get_finalized_command('build_ext')
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 299, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "C:\Users\Familia\AppData\Local\Temp\pip-build-env-km4q58s5\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "setup.py", line 247, in finalize_options
          raise ValueError(error_msg)
      ValueError: Boost library location was not found!
      Directories searched: conda env, /usr/local/include and /usr/include.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.


Solution 1:[1]

I have had a similar issue and fixed it by installing boost and swig libraries. Unfortunately, I do not completely know how to do that on Windows, but the rough sketch of what you should do is:

  1. Locate your active conda environment. If there are none, create and activate one before installing your project dependencies. To get to know the location of your environment, use conda info. For more, see this stackoverflow thread.
  2. Download boost and swig as archives from these links to their official website.
  3. Unpack the archives into the conda environment folder.
  4. Try installing again (make sure you have activated the environment) pip install -U numpy vina.

For the Linux and MacOS users that may have the same issue, the solution is very similar, except that you do not have to activate a conda environment. Instead, you can install boost and swig globally in your system, as described in this guide in the autodock-vina website.

  1. Install C++ compiler.

Ubuntu/Debian: sudo apt-get install build-essentials

macOS: Install Xcode from the AppStore and the Command Line Tools (CLT) from the terminal xcode-select --install

  1. Install boost and swig in your system

Ubuntu/Debian: sudo apt-get install libboost-all-dev swig

macOS (with Homebrew): brew install boost swig

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 oonh