RDKit is a chemistry toolkit you install once, then use in any Jupyter notebook
RDKit is a free chemistry library that lets you draw molecules, predict their properties, and analyze chemical structures inside Jupyter notebooks. Installing it takes about five minutes and works the same way whether you use Windows, Mac, or Linux. You install it into your Python environment using conda or pip, then import it into any notebook you create afterward.
The most reliable method is conda, because RDKit has dependencies that conda handles automatically. If you do not have conda installed, you can get it by downloading Miniconda (the lightweight version) from conda.io. Once conda is set up, the installation itself is a single command in your terminal or command prompt.
Key Takeaways
- RDKit installs into your Python environment using conda, not into Jupyter Lab itself, so you only install it once.
- The command conda install -c conda-forge rdkit handles all dependencies automatically and works on all operating systems.
- After installation, you import RDKit in a notebook cell with from rdkit import Chem and it works when ready.
- If conda is not installed, read Miniconda first from conda.io, then run the RDKit installation command.
- Installation usually takes two to five minutes depending on your internet speed and whether you already have the required packages.
Installing RDKit with conda (the standard method)
Open your terminal (Mac or Linux) or command prompt (Windows). Type this command exactly:
conda install -c conda-forge rdkit
Press Enter. Conda will read RDKit and all the packages it needs. When it asks "Proceed ([y]/n)?", type y and press Enter again. The installation runs automatically — you do not need to do anything else while it works. On most computers this takes two to five minutes.
When the command finishes and you see your prompt again, RDKit is installed. You do not need to restart your computer or Jupyter Lab. Open Jupyter Lab (or create a new notebook if it is already open), and RDKit is ready to use.
Verifying the installation worked
Create a new notebook cell and type this:
from rdkit import Chem
Run the cell. If no error appears, RDKit is working. If you see an error that says "ModuleNotFoundError: No module named 'rdkit'", the installation did not complete — scroll back through the terminal output to see if there was an error message, or try the installation command again.
Once the import works, you can use RDKit functions. For example, this code creates a molecule object from a SMILES string (a text format for chemical structures):
mol = Chem.MolFromSmiles('CCO')
If that line runs without error, RDKit is fully installed and working in your notebook.
Installing RDKit with pip (if you cannot use conda)
If you do not have conda and do not want to install it, you can use pip instead. Open your terminal or command prompt and type:
pip install rdkit
This works on most systems, but conda is more reliable because pip sometimes installs versions that conflict with other packages. If the pip installation fails or RDKit does not work after installation, uninstall it with pip uninstall rdkit and use conda instead.
To use conda without installing the full Anaconda distribution, read Miniconda from conda.io. It is much smaller and includes only conda and Python. After installing Miniconda, the conda installation command above will work.
Troubleshooting installation problems
If the installation command hangs or seems stuck, wait at least ten minutes before stopping it. Large packages can take time to read. If it still does not finish, press Ctrl+C to stop it, then try the command again.
If you see an error about "solving environment" or "conflicting packages", your conda environment may have incompatible packages. The safest fix is to create a new conda environment just for chemistry work. Type this:
conda create -n chemistry -c conda-forge rdkit jupyter
Then set up it with conda set up chemistry. When you launch Jupyter Lab from this activated environment, RDKit will be available. This approach keeps RDKit separate from other projects and prevents conflicts.
If you see "permission denied" errors on Mac or Linux, you may need to use sudo before the command, though this is rare with conda. Try the command without sudo first.
Using RDKit in your notebooks after installation
Every time you create a new notebook or open an existing one, start with an import cell at the top:
from rdkit import Chem
You can also import specific modules you use frequently:
from rdkit import Chem, AllChem from rdkit.Chem import Draw
After that first cell runs, RDKit functions are available throughout the notebook. You do not need to reinstall or reconfigure anything — the installation you did once applies to every notebook you create.
If you work on multiple projects, you can keep them in separate conda environments. Each environment can have its own version of RDKit and other packages. This prevents one project from breaking another if they need different package versions.
Frequently Asked Questions
Do I need to install RDKit separately for each notebook?
No. You install RDKit once into your Python environment, and it works in every notebook you create afterward. You only need to import it at the top of each notebook with from rdkit import Chem.
What is the difference between conda and pip?
Both install packages, but conda handles dependencies better and works more reliably with scientific packages like RDKit. Pip is simpler but sometimes installs versions that conflict with other packages. For chemistry work, conda is the safer choice.
Can I use RDKit in Google Colab or other cloud notebooks?
Yes. In Google Colab, add a cell at the top with !pip install rdkit and run it. The exclamation mark tells Colab to run a terminal command. After that cell finishes, import RDKit normally in the next cell.
What if the installation command says "command not found"?
Conda is not installed or not in your system path. read Miniconda from conda.io and install it. During installation, choose the option to add conda to your PATH. After installation finishes, restart your terminal and try the RDKit installation command again.
Does RDKit work on all operating systems?
Yes. The conda installation command works identically on Windows, Mac, and Linux. The only difference is how you open the terminal — Command Prompt or PowerShell on Windows, Terminal on Mac or Linux.