gnina / libmolgrid

Comprehensive library for fast, GPU accelerated molecular gridding for deep learning workflows
https://gnina.github.io/libmolgrid/
Apache License 2.0
144 stars 48 forks source link

Issue when install libmolgrid from source #114

Closed JonasLi-19 closed 1 year ago

JonasLi-19 commented 1 year ago

My system is CentOS7 (not root user), the libmolgrid-master.zip is installed and unzipped in /data2/rjli/software/libmolgrid After mkdir build && cd build, I run the following command in anaconda environment base: cmake -DCMAKE_INSTALL_PREFIX=/data2/rjli ..

Error information is : CMake Error at /data2/rjli/anaconda3/lib/cmake/Boost-1.78.0/BoostConfig.cmake:141 (find_package): Found package configuration file:

/data2/rjli/anaconda3/lib/cmake/boost_python-1.78.0/boost_python-config.cmake

but it set boost_python_FOUND to FALSE so package "boost_python" is considered to be NOT FOUND. Reason given by package:

No suitable build variant has been found.

The following variants have been tried and rejected:

Call Stack (most recent call first): /data2/rjli/anaconda3/lib/cmake/Boost-1.78.0/BoostConfig.cmake:262 (boost_find_component) /data2/rjli/software/cmake-3.18.0-Linux-x86_64/share/cmake-3.18/Modules/FindBoost.cmake:448 (find_package) python/CMakeLists.txt:17 (find_package)

ABOUT BOOST

I tried hard to solve this issue for days, including build boost_1_71_0 from source using python3.10 in anaconda/bin, using the command below: ./bootstrap.sh --with-libraries=all --with-python=/data2/rjli/anaconda3/bin/python3 --with-python-version=3.10 --with-python-root=/data2/rjli/anaconda3/lib/python3.10 --with-toolset=gcc

then add the following in the project-config.jam: using python : 3.10 : "/data2/rjli/anaconda3/lib/python3.10": /data2/rjli/anaconda3/include/python3.10 : /data2/rjli/anaconda3/lib;

but when run ./b2 there is always some libs that were skipped: libboost_python310.a

finally I choose to give up using installed boost from source, but I do not know how to do next...

I tried installing libmolgrid from source because I have network trouble in CentOS server that could not download libmolgrid automatically when installinf Gnina (our group is in China mailand). IS THERE ANY OTHER METHODS COULD BE ALRIGHT FOR ME TO USE TO INSTALL GNINA IN MY SYSTEM?

RMeli commented 1 year ago

Hello. Have you tried installing boost within your conda environment (conda install -c conda-forge boost) and pointing CMake to the right location?

Alternatively, you might try the experimental Spack support described in https://github.com/gnina/gnina/pull/184 (but also requires internet access, and has never been tested on CentOS7).

JonasLi-19 commented 1 year ago

Thanks for your quick reply to help me! But I am puzzled by my current boost&cmake situation... I do not know your meaning of "point CMake to the right location", maybe you mean ‘cmake -DCMAKE_PREFIX_PATH=/path/to/cmake -DBOOST_ROOT=/path/to/boost ..’ ?But I can't figure out what is my CMAKE_PREFIX_PATH(explained below)...

_Original cmake .. that didn't work: cmake -DCMAKE_INSTALLPREFIX=/data2/rjli ..

I did have installed boost in conda base env before:

(base) [rjli@node13 build]$ conda list boost boost 0.1 pypi_0 pypi boost-cpp 1.78.0 h5adbc97_2 conda-forge

Is there any bugs in this boost and boost-cpp module?

CMAKE

As my former cmake is [3.26.4], which I remember is not suitable, installed in ~/software folder . So my current cmake [3.18.0] is installed in ~/software folder as well, and linked by a command "ln -sf data2/rjli/software/cmake-3.18.0/bin/* /data2/rjli/bin" (There is also a cmake module in conda base env which is [3.22.1])

Tried Boost from source but failed so I installed boost module in conda

as I have told before, I had trouble in install Boost_1_71_0 because it always causes error for installing libmolgrid to find libboost_python310.a even if I had assign the python location in ./bootstrap.sh

./bootstrap.sh --with-libraries=all --with-python=/data2/rjli/anaconda3/bin/python3 --with-python-version=3.10 --with-python-root=/data2/rjli/anaconda3/lib/python3.10 --with-toolset=gcc

add the following into project-config.jam:

using python : 3.10 : "/data2/rjli/anaconda3/lib/python3.10": /data2/rjli/anaconda3/include/python3.10 : /data2/rjli/anaconda3/lib;

the following is the ./b2 error when getting Boost_1_71_0:

...skipped <pbin.v2/libs/python/build/gcc-4.8.5/release/python-3.10/threading-multi/visibility-hidden>libboost_python310.so.1.71.0 for lack of <pbin.v2/libs/python/build/gcc-4.8.5/release/python-3.10/threading-multi/visibility-hidden>exec.o... ...skipped <p/data2/rjli/software/boost_1_71_0/stage/lib>libboost_python310.so.1.71.0 for lack of <pbin.v2/libs/python/build/gcc-4.8.5/release/python-3.10/threading-multi/visibility-hidden>libboost_python310.so.1.71.0... ...skipped <p/data2/rjli/software/boost_1_71_0/stage/lib>libboost_python310.so for lack of <p/data2/rjli/software/boost_1_71_0/stage/lib>libboost_python310.so.1.71.0... ...skipped <p/data2/rjli/software/boost_1_71_0/stage/lib>libboost_python310.so.1 for lack of <p/data2/rjli/software/boost_1_71_0/stage/lib>libboost_python310.so.1.71.0... ...skipped <p/data2/rjli/software/boost_1_71_0/stage/lib>libboost_python310.so.1.71 for lack of <p/data2/rjli/software/boost_1_71_0/stage/lib>libboost_python310.so.1.71.0...

JonasLi-19 commented 1 year ago

Especially, I wonder why I constanly got error in 【package "boost_python" is considered to be NOT FOUND. 】no matter install boost from source or install boost in conda! As I am going to use boost in conda, is there any other module I need to install in conda to solve this "boost_python" problem?

CMake Error at /data2/rjli/anaconda3/lib/cmake/Boost-1.78.0/BoostConfig.cmake:141 (find_package): Found package configuration file:

/data2/rjli/anaconda3/lib/cmake/boost_python-1.78.0/boost_python-config.cmake

but it set boost_python_FOUND to FALSE so package "boost_python" is considered to be NOT FOUND. Reason given by package:

No suitable build variant has been found.

The following variants have been tried and rejected:

RMeli commented 1 year ago

@JonasLi-19 to me the error messages you get seem to indicate that CMake does not find a version of boost compatible with the Python interpreter it finds. I'd double check the Python interpreter found by CMake and make sure it is the one you expect.

Since you have a complex environment with system packages and an Anaconda distribution, you likely need to help CMake a bit by setting the corresponding variables (such as BOOST_ROOT etc, Python_EXECUTABLE etc).

RMeli commented 1 year ago

I can confirm this is the case; I just run into the same issue with spack install libmolgrid.

It seems that libmolgrid's CMake has a strong preference for the system:

-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.11.so (found version "3.11.2") 
-- Found PythonInterp: /usr/bin/python3.11 (found version "3.11.2") 
CMake Error at /home/rmeli/spack/opt/spack/linux-ubuntu23.04-zen4/gcc-11.3.0/boost-1.82.0-gvrkquvhcqglqad6anmrgolrzkwjspmm/lib/cmake/Boost-1.82.0/Boost
Config.cmake:141 (find_package):
  Found package configuration file:

    /home/rmeli/spack/opt/spack/linux-ubuntu23.04-zen4/gcc-11.3.0/boost-1.82.0-gvrkquvhcqglqad6anmrgolrzkwjspmm/lib/cmake/boost_python-1.82.0/boost_pyt
hon-config.cmake

  but it set boost_python_FOUND to FALSE so package "boost_python" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

  The following variants have been tried and rejected:

  * libboost_python310.so.1.82.0 (3.10, Boost_PYTHON_VERSION=3.11)

  * libboost_python310.a (3.10, Boost_PYTHON_VERSION=3.11)

Call Stack (most recent call first):
  /home/rmeli/spack/opt/spack/linux-ubuntu23.04-zen4/gcc-11.3.0/boost-1.82.0-gvrkquvhcqglqad6anmrgolrzkwjspmm/lib/cmake/Boost-1.82.0/BoostConfig.cmake:
262 (boost_find_component)
  /home/rmeli/spack/opt/spack/linux-ubuntu23.04-zen4/gcc-11.3.0/cmake-3.26.3-xm7jqizk3hey32gkxk7o6vg46l4giddn/share/cmake-3.26/Modules/FindBoost.cmake:
594 (find_package)
  python/CMakeLists.txt:17 (find_package)

-- Configuring incomplete, errors occurred

You can see it finds the libboost_python310 library from Spack's Python, but PythonInterp is from /usr/bin/. This is likely what's happening to you too, as mentioned above.

Setting the Python executable explicitly when running CMake with -DPYTHON_EXECUTABLE=PATH_TO_YOUR_PYTHON_EXECUTALBE should fix the issue.

JonasLi-19 commented 1 year ago

Trouble in make install

Result

import molgrid /data2/rjli/anaconda3/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so: symbol cudaGraphInstantiateWithFlags, version libcudart.so.11.0 not defined in file libcudart.so.11.0 with link time reference Failed to import torch.

ERROR information of make install

/data2/rjli/anaconda3/lib/python3.10/site-packages/setuptools/dist.py:529: UserWarning: Normalizing 'v0.5.3' to '0.5.3' warnings.warn(tmpl.format(**locals())) running install /data2/rjli/anaconda3/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /data2/rjli/anaconda3/lib/python3.10/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( Checking .pth file support in /data2/rjli/lib/python3.10/site-packages/ /data2/rjli/anaconda3/bin/python3.10 -E -c pass TEST FAILED: /data2/rjli/lib/python3.10/site-packages/ does NOT support .pth files bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:

/data2/rjli/lib/python3.10/site-packages/

and your PYTHONPATH environment variable currently contains:

'/data2/rjli/software/rdkit-Release_2022_09_1'

Here are some of your options for correcting the problem:

Please make the appropriate changes for your system and try again.

By the way, assigning -DPYTHON_EXECUTABLE=PATH_TO_YOUR_PYTHON_EXECUTALBE is helpful! Thanks @RMeli

RMeli commented 1 year ago

I'm glad it helped. The installation error (is it actually an error or just a warning?) seems pretty clear:

You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from.

It also suggests possible solutions:

Kerro-junior commented 1 year ago

I also met whis problem when in python

import molgrid

It raises Fail information: ~/anaconda3/lib/python3.10/site-packages/torch/lib/libtorch_cuda.so: symbol cudaGraphInstantiateWithFlags, version libcudart.so.11.0 not defined in file libcudart.so.11.0 with link time reference Failed to import torch.

Is this because I did not have pytorch installed?

JonasLi-19 commented 1 year ago

To summarize, I finished build the libmolgrid by the following steps after install openbabel in conda

1.add the necessary libs location into ~/.bashrc export LD_LIBRARY_PATH=/data2/rjli/anaconda3/envs/py36/lib:$LD_LIBRARY_PATH export CPLUS_INCLUDE_PATH=/data2/rjli/anaconda3/envs/py36/include:$CPLUS_INCLUDE_PATH

2. cmake -DCMAKE_INSTALL_PREFIX=/data2/rjli -DPYTHON_EXECUTABLE=/data2/rjli/anaconda3/envs/py36/bin-DOPENBABEL3_INCLUDE_DIR=/data2/rjli/anaconda3/envs/py36/include/openbabel3 -DOPENBABEL3_LIBRARIES=/data2/rjli/anaconda3/envs/py36/lib/libopenbabel.so ..