!wget -c https://repo.continuum.io/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh
!chmod +x Miniconda3-py37_4.8.3-Linux-x86_64.sh
!time bash ./Miniconda3-py37_4.8.3-Linux-x86_64.sh -b -f -p /usr/local
!time conda install -q -y -c conda-forge rdkit
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/')
: The code from <Installing RDKit in Google Colab>
The code above is one of the solutions from another article in stackoverflow on importing 'rdkit' in Google Colab, but it didn't work for me with this error message:
from rdkit import Chem
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /usr/local/lib/python3.7/site-packages/rdkit/DataStructs/cDataStructs.so)
Does anybody know how to solve this ImportError: `GLIBCXX_3.4.26' not found problem? I sincerely need help! Big thx!
The answer you linked is a little outdated now. Seems like there is also an issue with installing the latest build of the RDKit (2020.09.3) on Colab. Installing the older version (2020.09.2) seems to solve the issue:
%%bash
wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
conda config --set always_yes yes --set changeps1 no
conda install -q -y -c conda-forge python=3.7
conda install -q -y -c conda-forge rdkit==2020.09.2
Followed by:
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/')
from rdkit import Chem
If you must install the latest build (2020.09.3), I have found a workaround by adding a few lines to the bash cell:
%%bash
add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update --fix-missing
apt-get dist-upgrade
wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
conda config --set always_yes yes --set changeps1 no
conda install -q -y -c conda-forge python=3.7
conda install -q -y -c conda-forge rdkit
To make this work the runtime also will need to be restarted, I just add a try/except around the rdkit import to restart the runtime automatically:
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/')
try:
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
except ImportError:
print('Stopping RUNTIME. Colaboratory will restart automatically. Please run cell again.')
exit()
Colab link for the first solution: https://colab.research.google.com/drive/1vhsLgzA7A_INMcbU-hG6go4M6axvbUpi?usp=sharing
Colab link for the second solution: https://colab.research.google.com/drive/1Ix0oyUU4cA1b2rD9JfkMhy8M2z5Y_vTL?usp=sharing