rdkit module functions in Chem.Descriptors not working and unsure why?

Question:

I’m new to using rdkit but can’t find any forum posts online addressing this but I’ve been trying to use the functions in rdkit.Chem.Descriptors as follows:

from rdkit import Chem

mol = Chem.MolFromSmiles('CC')

Descriptors.MolWt(mol)

this should just return the molecular weight = 30.07 of the molecule simply and I took this from the documentation but it just gives me an error saying:

NameError: name 'Descriptors' is not defined

I have no idea why – I tried changing versions but this has made no difference. It seems to be an error inherent to all functions in the Descriptor class.

I’ve also tried explicitly importing the Descriptor submodule/class and this doesn’t work either.

Asked By: Stuchfield

||

Answers:

from rdkit.Chem import Descriptors

is the correct way to import module for this code to work

Answered By: Stuchfield
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.