RDKit is a chemistry toolkit you install once, then use in Jupyter cells
RDKit is a free chemistry software library that lets you draw molecules, predict their properties, and analyze chemical structures inside Jupyter Notebook. You install it using a package manager called conda, which handles all the dependencies RDKit needs to run. Once installed, you import it at the top of your notebook and use it in any cell below.
The installation takes about five minutes and works the same way on Windows, Mac, and Linux. The most common mistake is trying to install RDKit using pip instead of conda — pip often fails because RDKit has complex dependencies that conda handles automatically. If you already have Jupyter Notebook running, you will need to close it, install RDKit, and then restart Jupyter.
Key Takeaways
- RDKit installs through conda, not pip, because it has dependencies that pip cannot resolve reliably.
- You must close Jupyter Notebook before installing RDKit, then restart it afterward so the notebook can find the new library.
- After installation, you import RDKit with from rdkit import Chem at the top of your notebook cell.
- If installation fails, the most likely cause is using pip instead of conda or installing into the wrong conda environment.
Install conda if you do not have it yet
RDKit installs through conda, a package manager that comes with Anaconda or Miniconda. If you already installed Anaconda or Miniconda on your computer, you have conda and can skip to the next section. If you are not sure, open your terminal or command prompt and type conda --version. If a version number appears, you have conda. If you see "command not found" or similar, you need to install Miniconda first.
read Miniconda from the official Conda website. Choose the version that matches your operating system (Windows, Mac, or Linux) and whether your computer is 64-bit or 32-bit. Run the installer and follow the prompts. When asked whether to add conda to your PATH, select yes — this lets you use conda commands in your terminal. After installation finishes, close and reopen your terminal so the changes take effect.
Close Jupyter Notebook and open your terminal
If Jupyter Notebook is currently running, close it completely. Do not just close the browser tab — close the terminal or command prompt window where Jupyter is running. This stops the Python process that Jupyter uses.
Then open a fresh terminal or command prompt. On Windows, search for "Command Prompt" or "PowerShell" in the Start menu. On Mac or Linux, open Terminal from your Applications folder or use Spotlight search. You will type conda commands here to install RDKit.
Run the conda install command for RDKit
In your terminal, type this command exactly and press Enter:
conda install -c conda-forge rdkit
This tells conda to install RDKit from the conda-forge channel, which is where the most up-to-date version lives. Conda will read RDKit and all the libraries it depends on — this usually takes two to five minutes depending on your internet speed. When conda asks "Proceed ([y]/n)?", type y and press Enter to confirm.
If you use a specific conda environment instead of the base environment, set up that environment first by typing conda set up environment_name (replace environment_name with your actual environment name), then run the install command. This ensures RDKit installs where your Jupyter Notebook can find it.
Restart Jupyter Notebook and test the import
After installation finishes, open a new terminal window and start Jupyter Notebook the way you normally do. If you usually type jupyter notebook, use that same command. Jupyter will open in your browser.
Create a new notebook or open an existing one. In the first cell, type this line and run it:
from rdkit import Chem
If the cell runs without error, RDKit is installed correctly. If you see an error like "ModuleNotFoundError: No module named 'rdkit'", the installation did not reach the right environment — see the troubleshooting section below.
Verify RDKit works with a straightforward molecule
In a new cell below your import, type this code to create and display a straightforward molecule:
mol = Chem.MolFromSmiles('CCO') mol
Run the cell. If RDKit is working, you will see a small image of an ethanol molecule appear. This confirms that RDKit can create molecules from SMILES strings (a text format for chemical structures) and display them in Jupyter. You can now use RDKit in any cell in this notebook by importing it once at the top.
Troubleshooting installation problems
If you see "ModuleNotFoundError: No module named 'rdkit'" after restarting Jupyter, the most common cause is that Jupyter is running in a different conda environment than the one where you installed RDKit. Check which environment Jupyter is using by running this in a notebook cell:
import sys print(sys.executable)
This shows the path to the Python that Jupyter is using. If it does not match the environment where you installed RDKit, close Jupyter, set up the correct environment in your terminal, then restart Jupyter from that same terminal window.
If installation failed with a message about conflicting dependencies, try installing into a fresh conda environment instead of your base environment. In your terminal, type:
conda create -n rdkit_env -c conda-forge rdkit conda set up rdkit_env jupyter notebook
This creates a new environment called rdkit_env, installs RDKit there, and starts Jupyter from that environment. Any notebook you create will have access to RDKit.
Frequently Asked Questions
Can I install RDKit with pip instead of conda?
RDKit has dependencies that pip cannot always resolve, so conda is the reliable method. If you try pip and it fails, uninstall with pip uninstall rdkit and use conda instead. Some users report pip works on certain systems, but conda works on all of them.
Why does my Jupyter Notebook not see RDKit after I installed it?
Jupyter is likely running in a different conda environment than the one where you installed RDKit. Close Jupyter completely, set up the environment where you installed RDKit with conda set up environment_name, then start Jupyter from that terminal window.
Do I need to install RDKit in every conda environment I use?
Yes. Each conda environment is separate, so if you create a new environment and want to use RDKit there, you must run the conda install command in that environment. You only need to do this once per environment.
What if the conda install command takes a very long time or seems stuck?
RDKit has many dependencies, so installation can take several minutes on slower internet connections. If it has been more than ten minutes with no progress, press Ctrl+C to stop it, then try again. If it fails repeatedly, your internet connection may be unstable — try again later or use a different network.
Can I use RDKit in Google Colab or other cloud notebooks?
Yes, but the installation command is different. In a Colab cell, type !pip install rdkit-pypi instead of using conda. Colab does not use conda, so you install the PyPI version of RDKit instead. After running that cell, restart the runtime and import RDKit normally.