rdkit / homebrew-rdkit

Homebrew formula for rdkit
44 stars 19 forks source link

RDKit installation problem on macOS Big Sur #108

Closed JuergenDi closed 3 years ago

JuergenDi commented 3 years ago

Configuration:

After those issues documented in previous reports, I reinstalled booth, rdkit with:

brew update Already up-to-date.

brew uninstall --ignore-dependencies boost boost-python3 rdkit Uninstalling /usr/local/Cellar/boost/1.75.0_1... (15,058 files, 524.2MB) Uninstalling /usr/local/Cellar/boost-python3/1.75.0... (472 files, 18.5MB) Uninstalling /usr/local/Cellar/rdkit/2020.09.1... (1,671 files, 66.8MB)

brew install rdkit --with-python3 ==> Installing rdkit from rdkit/rdkit ==> Downloading https://homebrew.bintray.com/bottles/boost-1.75.0_1.big_sur.bott Already downloaded: /Users/jd/Library/Caches/Homebrew/downloads/f3136c231545902ba78c4f23a11c4c54cb25503b0621f752eaff050864696ad4--boost-1.75.0_1.big_sur.bottle.tar.gz ==> Downloading https://homebrew.bintray.com/bottles/boost-python3-1.75.0.big_su Already downloaded: /Users/jurgendietrich/Library/Caches/Homebrew/downloads/4debada41d850df683fa95c22070861300a34d908eb9a5ae7c37d3942b26abfc--boost-python3-1.75.0.big_sur.bottle.1.tar.gz ==> Downloading https://github.com/rdkit/rdkit/archive/Release_2020_09_1.tar.gz Already downloaded: /Users/jurgendietrich/Library/Caches/Homebrew/downloads/377d0a717f4f8caf8be184a84798d57935742421c99a356ce30bd1222cb745f0--rdkit-Release_2020_09_1.tar.gz ==> Installing dependencies for rdkit/rdkit/rdkit: boost and boost-python3 ==> Installing rdkit/rdkit/rdkit dependency: boost ==> Pouring boost-1.75.0_1.big_sur.bottle.tar.gz 🍺 /usr/local/Cellar/boost/1.75.0_1: 15,058 files, 524.2MB ==> Installing rdkit/rdkit/rdkit dependency: boost-python3 ==> Pouring boost-python3-1.75.0.big_sur.bottle.1.tar.gz Warning: boost-python3 dependency gcc was built with a different C++ standard library (libstdc++ from clang). This may cause problems at runtime. 🍺 /usr/local/Cellar/boost-python3/1.75.0: 472 files, 18.5MB ==> Installing rdkit/rdkit/rdkit --with-python3 detected clang C++ compiler ==> cmake -DRDK_INSTALL_INTREE=OFF -DRDK_BUILD_CPP_TESTS=OFF -DRDK_INSTALL_STATI ==> make -j4 ==> make install Warning: rdkit/rdkit/rdkit dependency gcc was built with a different C++ standard library (libstdc++ from clang). This may cause problems at runtime. ==> Caveats You may need to add RDBASE to your environment variables. For Bash, put something like this in your $HOME/.bashrc: export RDBASE=/usr/local/share/RDKit ==> Summary 🍺 /usr/local/Cellar/rdkit/2020.09.1: 1,671 files, 66.8MB, built in 18 minutes 18 seconds ==> Caveats ==> rdkit You may need to add RDBASE to your environment variables. For Bash, put something like this in your $HOME/.bashrc: export RDBASE=/usr/local/share/RDKit

echo $RDBASE /usr/local/share/RDKit

echo $PYTHONPATH /usr/local/lib/python3.9:/usr/local/share/RDKit

echo $DYLD_LIBRARY_PATH /usr/local/share/RDKit/lib

ls $RDBASE/lib ls: /usr/local/share/RDKit/lib: No such file or directory

Python 3.9.1 (default, Feb 2 2021, 06:12:30) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import rdkit Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'rdkit'

Any recommendations?

UnixJunkie commented 3 years ago

I guess you are not using the python interpreter for which rdkit was installed. Now comes the next question: how to find out which one it is... Brute force answer: find all the python3 executables on your computer, try import rdkit in them one by one...

UnixJunkie commented 3 years ago

The script roundtrip_test.py uses /usr/local/bin/python3.9. You can try this one first.

JuergenDi commented 3 years ago

Short update: FYI, I installed anaconda3 (python 3.7, download of actual version) and was able to run rdkit including additional tools (like Mol2Vec) succesfully. Due to the limitations I do not like (and normally do not use) conda, I will try to figure out which python version is working with rdkit as recommended. However, the setting of DYLD_LIBRARY_PATH is obviously wrong, could you please give an update here which directory should be referred to? Or is the installation description not longer valid? (Normally I do not use also PYTHONHOME and PYTHONPATH, I only set those variables due to the installation guidance). Thanks in advance!

UnixJunkie commented 3 years ago

On the Mac where I have rdkit installed and working via brew: DYLD_LIBRARY_PATH is empty. PYTHONHOME and PYTHONPATH are also empty. The python interpreter is this one: /usr/local/bin/python3.9

PS: I really do not like conda (too slow, too stpuid at updating an existing environment, only working when creating a new environment from scratch, polluting many environment variables)

UnixJunkie commented 3 years ago

You can try this to force brew installing rdkit (brew is also a rather dumb package manager, with bad reproducibility of installs):

# backup you installed packages list
brew list --formula > my_brew_packages.txt
# uninstall all of them
brew uninstall --force $(brew list --formula)
# try installing rdkit from fresh
brew install rdkit --with-python3 --with-inchi
UnixJunkie commented 3 years ago

FTR on a recent Ubuntu:

sudo apt install python3-rdkit

And the job would be done, system-wide, for a fraction of the time... :)

JuergenDi commented 3 years ago

Ok thanks I followed your brew deinstallation suggestion and afterwards I reinstalled Python 3.9.1 and now it works. I need to get rid of conda and clean the environment variables (I assume the problem occurs when pyenv is installed?). Again thanks for your great support )