Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install RDKit with Conda for an isolated environment or with pip in an existing Python setup, then use its Python API to load and inspect molecular structures. The examples below take you from installation to parsing SMILES and molecular files, inspecting atoms and bonds, drawing molecules, reading collections, and searching for substructures.

Choose an installation method

RDKit’s official installation guide covers Conda, pip, operating-system package repositories, and building from source. These two commands are documented routes; use the one that fits your Python environment. See the RDKit installation guide for platform-specific details and other methods.

Route Use it when Command
Conda You want RDKit in a dedicated environment managed through conda-forge. conda create -c conda-forge -n my-rdkit-env rdkit
conda activate my-rdkit-env
pip You want to install it into an existing Python environment. The guide reports platform wheels for Linux, Windows, and macOS. pip install rdkit
Operating-system package or source build You prefer a platform package repository or need to compile RDKit and configure optional features. Follow the matching operating-system or source-build instructions in the official guide.

After installation, run Python from the same environment where RDKit was installed. For Conda, activate my-rdkit-env before starting Python or running a script.

Parse a molecule and check the result

The RDKit Python guide starts with from rdkit import Chem and demonstrates creating a molecule from SMILES, a text notation for chemical structures. A successful parse returns an RDKit Mol object. An invalid input can instead return None, so check before calling methods on the result.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
from rdkit import Chem

mol = Chem.MolFromSmiles("Cc1ccccc1")
if mol is None:
    raise ValueError("Could not parse the molecular structure")

print(mol.GetNumAtoms())

This example parses a SMILES string and prints the number of atoms in the resulting molecule. RDKit’s Getting Started with the RDKit in Python guide also demonstrates loading a molecule from a file or a MOL block:

from rdkit import Chem

mol_from_file = Chem.MolFromMolFile("structure.mol")
mol_from_block = Chem.MolFromMolBlock(mol_block_text)

for mol in (mol_from_file, mol_from_block):
    if mol is None:
        print("Could not parse this input")
    else:
        print(mol.GetNumAtoms())

Replace structure.mol with your file path and mol_block_text with the MOL block content. Both file-oriented functions can fail to parse input and return None; do not assume that a file being present means its structure was read successfully.

Inspect atoms and bonds

Once parsing succeeds, iterate through the molecule’s atoms and bonds to inspect basic structural information such as element symbols, atomic numbers, and bond types.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
for atom in mol.GetAtoms():
    print(atom.GetIdx(), atom.GetSymbol(), atom.GetAtomicNum())

for bond in mol.GetBonds():
    print(
        bond.GetBeginAtomIdx(),
        bond.GetEndAtomIdx(),
        bond.GetBondType(),
    )

Atom indices let you identify the endpoints of a bond in the same molecule. These properties are a useful first inspection; they do not by themselves establish that the supplied structure represents the compound you intended.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Draw a molecule

RDKit’s drawing module can create a depiction from a parsed molecule. The guide demonstrates rdkit.Chem.Draw.MolToImage(); its drawing examples also discuss generating 2D coordinates for depictions.

from rdkit.Chem import Draw

image = Draw.MolToImage(mol)
image.save("molecule.png")

For a source build intended to produce high-quality PNG depictions, the installation guide says to install Cairo and enable Cairo support during the build. This is an optional build consideration, not a prerequisite stated for every RDKit installation.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Read a collection of structures

Supplier classes let you process collections instead of loading one structure at a time. For example, Chem.SDMolSupplier reads an SDF file, and Chem.SmilesMolSupplier reads a collection of SMILES. Check each result because a supplier can yield None for a structure it cannot read.

from rdkit import Chem

supplier = Chem.SDMolSupplier("structures.sdf")
for index, mol in enumerate(supplier):
    if mol is None:
        print(f"Could not read structure {index}")
        continue
    print(index, mol.GetNumAtoms())

Use the corresponding supplier for your input format, and keep the failure check inside the loop so one unreadable entry does not lead to method calls on None.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Search for a substructure with SMARTS

SMARTS describes a structural query. Parse it with Chem.MolFromSmarts(), then test a molecule with HasSubstructMatch() or retrieve matching atom-index tuples with GetSubstructMatches().

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
query = Chem.MolFromSmarts("[OH]")
if query is None:
    raise ValueError("Could not parse the SMARTS query")

if mol.HasSubstructMatch(query):
    matches = mol.GetSubstructMatches(query)
    print(matches)

The example checks for a query matching an oxygen attached to hydrogen. Choose a SMARTS pattern that expresses the structural feature you actually want to find; a successful match indicates that the pattern occurs in the parsed molecule.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Explore fingerprint similarity maps

The Python guide includes a SimilarityMaps workflow using fingerprints, including atom-pair, topological-torsion, and Morgan fingerprints. Such a map visualizes fingerprint-based similarity information for a molecule; it is one documented way to compare structures visually, not the only way to compare molecules.

Refer to the guide’s fingerprint and similarity-map examples for the required setup and API details: Getting Started with the RDKit in Python.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

When a source build needs optional features

A standard Conda or pip installation is the simpler starting point for the Python workflows above. If you compile RDKit yourself, choose build options according to the features you need; the installation guide distinguishes these optional dependencies from basic installation.

  • Cairo: the guide recommends Cairo support for high-quality PNG structure depiction.
  • Eigen3: the guide identifies Eigen3 as needed for 3D descriptors.
  • InChI: the guide also documents enabling InChI support in a source build.

Follow the installation guide’s section for your operating system and desired build features rather than assuming these components are required for every user.

Troubleshoot the first run

  • ModuleNotFoundError: No module named 'rdkit': confirm that the Python interpreter running your script is the one associated with the environment where you installed RDKit. If using the Conda example, activate my-rdkit-env first.
  • A parse function returns None: verify the input string or file content and handle the failure before using molecule methods. RDKit may also emit diagnostics for invalid input.
  • A PNG or optional descriptor feature is unavailable: check whether your installation method and, for source builds, selected optional dependencies and build options support that feature.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.