shape-it icon indicating copy to clipboard operation
shape-it copied to clipboard

CMake Path Issue when Using RDKit Conda Install

Open kheyer opened this issue 4 years ago • 2 comments

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.

kheyer avatar Jan 23 '21 22:01 kheyer

@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

TannerW-STX avatar Apr 29 '21 18:04 TannerW-STX

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

-D Boost_INCLUDE_DIR=$CONDA_PREFIX/include/

dww100 avatar Nov 10 '21 16:11 dww100

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

dww100 avatar Oct 12 '24 15:10 dww100