rdkit / shape-it

Updated version of Silicos-it's shape-based alignment tool
MIT License
40 stars 12 forks source link

CMake Path Issue when Using RDKit Conda Install #10

Open kheyer opened 3 years ago

kheyer commented 3 years ago

Thanks for making this available through RDKit!

When I compiled the code, I ran into issues with CMake not finding RDKit libs. I believe this is because I have RDKit installed through Anaconda. Specifically I found ${RDKIT_LIBRARIES} was not set and CMake was picking up a Python install outside of the Anaconda installation I was trying to use. The solution was to add more compile flags:

cmake   -D CMAKE_INSTALL_PREFIX=<install location> \
        -D CMAKE_PREFIX_PATH=$CONDA_PREFIX \
        -D BUILD_RDKIT_SUPPORT=ON \
        -D BUILD_PYTHON_SUPPORT=ON \
        -D RDKIT_INCLUDE_DIR=/anaconda3/envs/myenv/include/rdkit \
        -D Boost_INCLUDE_DIR=/anaconda3/envs/myenv/include \
        -D Python3_FIND_STRATEGY=LOCATION \
        -D PYTHON_INSTDIR=lib/python3.6/site-packages ..

After adding the additional flags, I was able to successfully compile the code.

TannerW-STX commented 3 years ago

@kheyer We too had some headaches getting shapeit to compile in conda envs. Thankfully your comment saved us a little time debugging. We also needed to install gxx_linux-64.

Here is a copy and paste of my terminal if it is fruitful for anyone out there:

conda create --name shapeit
conda activate shapeit
conda install -y -c conda-forge rdkit cmake
conda install -y gxx_linux-64
git clone https://github.com/rdkit/shape-it.git
mkdir shape-it_install
cd shape-it
mkdir build && cd build
cmake -D CMAKE_PREFIX_PATH=$CONDA_PREFIX \
-D CMAKE_INSTALL_PREFIX=<path>/shape-it_install/ \
-D BUILD_RDKIT_SUPPORT=ON \
-D BUILD_PYTHON_SUPPORT=ON \
-D PYTHON_INSTDIR=$CONDA_PREFIX/lib/python3.9/site-packages \
-D Boost_INCLUDE_DIR=$CONDA_PREFIX/include/Boost \
-D RDKIT_INCLUDE_DIR=$CONDA_PREFIX/include/rdkit \
-D Python3_FIND_STRATEGY=LOCATION ..
make -j12
make install
dww100 commented 3 years ago

Doing this today required a small edit - changing the Boost include directory:

-D Boost_INCLUDE_DIR=$CONDA_PREFIX/include/
dww100 commented 1 month ago

In case it helps anyone currently the above methods runs into issues not finding headers in the current conda-forge version of rdkit. The rdkit channel works using the following recipe (note: this pins the version of Python to 3.7):

conda create --name shapeit
conda activate shapeit
conda install -y -c rdkit rdkit 
conda install -y -c conda-forge cmake gxx_linux-64
git clone https://github.com/rdkit/shape-it.git
mkdir shape-it_install
cd shape-it
mkdir build && cd build
cmake -D CMAKE_PREFIX_PATH=$CONDA_PREFIX \
-D CMAKE_INSTALL_PREFIX=<path>/shape-it_install/ \
-D BUILD_RDKIT_SUPPORT=ON \
-D BUILD_PYTHON_SUPPORT=ON \
-D PYTHON_INSTDIR=$CONDA_PREFIX/lib/python3.7/site-packages \
-D Boost_INCLUDE_DIR=$CONDA_PREFIX/include/ \
-D RDKIT_INCLUDE_DIR=$CONDA_PREFIX/include/rdkit \
-D Python3_FIND_STRATEGY=LOCATION ..
make -j12
make install
pgoverna commented 3 weeks ago

Hi! Is this still a valid way to compile? I tried today and it did not work. This is the command I used:

cmake -D CMAKE_PREFIX_PATH=$CONDA_PREFIX CMAKE_INSTALL_PREFIX=/home/pgoverna/local/shape-it BUILD_RDKIT_SUPPORT=ON BUILD_PYTHON_SUPPORT=ON PYTHON_INSTDIR=$CONDA_PREFIX/lib/python3.7/site-packages Boost_INCLUDE_DIR=$CONDA_PREFIX/include/ RDKIT_INCLUDE_DIR=$CONDA_PREFIX/include/rdkit Python3_FIND_STRATEGY=LOCATION ..

I got these warnings:

CMake Warning:
  Ignoring extra path from command line:

   "/home/pgoverna/local/shape-it/build/CMAKE_INSTALL_PREFIX=/home/pgoverna/local/shape-it"

CMake Warning:
  Ignoring extra path from command line:

   "Python3_FIND_STRATEGY=LOCATION"

and then this error message:

CMake Error in CMakeLists.txt:
  Found relative path while evaluating include directories of "shapeit_lib":

    "OPENBABEL3_INCLUDE_DIR-NOTFOUND"

CMake Error in CMakeLists.txt:
  Found relative path while evaluating include directories of "shape-it":

    "OPENBABEL3_INCLUDE_DIR-NOTFOUND"

Any clue why this is happening? Thanks a lot