I am working on building a script that tests the binding affinity of protein-ligand pairs generated by our ML model as positive/negative binding annotations. One of the steps in doing so requires the download of .SDF files from PubChem, and in order to prepare them for autodocking they need to be converted to .PDB files. The only real solution that I have found has been using OpenBabel to convert the file type, but I am completely unable to install the package on my computer. Whether or not I have the latest package downloaded, every time I type pip install openbabel I recieve the following error message:

Installing collected packages: openbabel
  Running setup.py install for openbabel ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\chris\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"'; __file__='"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\chris\AppData\Local\Temp\pip-record-enmjb591\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\chris\AppData\Local\Temp\pip-install-pnt2eol5\openbabel\
    Complete output (14 lines):
    running install
    running build_ext
    Warning: invalid version number ''.
    Guessing Open Babel location:
    - include_dirs: ['c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\include', 'c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\include', '/usr/local/include/openbabel3']
    - library_dirs: ['c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\libs', 'c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\PCbuild\\amd64', '/usr/local/lib']
    building 'openbabel._openbabel' extension
    swigging openbabel\openbabel-python.i to openbabel\openbabel-python_wrap.cpp
    swig.exe -python -c++ -small -O -templatereduce -naturalvar -Ic:\users\chris\appdata\local\programs\python\python38\include -Ic:\users\chris\appdata\local\programs\python\python38\include -I/usr/local/include/openbabel3 -o openbabel\openbabel-python_wrap.cpp openbabel\openbabel-python.i

    Error: SWIG failed. Is Open Babel installed?
    You may need to manually specify the location of Open Babel include and library directories. For example:
      python setup.py build_ext -I/usr/local/include/openbabel3 -L/usr/local/lib
      python setup.py install
ERROR: Command errored out with exit status 1: 'c:\users\chris\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"'; __file__='"'"'C:\\Users\\chris\\AppData\\Local\\Temp\\pip-install-pnt2eol5\\openbabel\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\chris\AppData\Local\Temp\pip-record-enmjb591\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

I have attempted to use conda to install the same openbabel package but I have been confronted with the same error

  • $\begingroup$ It's not a PyBind11 or Boost package wrapping the library (.so). It's a SWIG wrapper that needed a valid installation of the regular app. If it's installed but in a non-standard way, the python package is probably look for the libraries in /usr/local/lib but cannot find them, so needs to be told —our you could copy them messily. EDIT: Oh, just noticed that's a Windows. Ignore the Unix path. There's probably a Windows equivalent. $\endgroup$ Apr 8 at 8:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.