pythonrdkit

molecule image in vscode


I try to show my molecule in vscode but it doesn't work. But in jupyter notebook was every thing fine.

from rdkit import Chem
from rdkit.Chem import Draw

a = Chem.MolFromSmiles("c1cocc1")
b = Chem.AddHs(a)
Draw.MolsToImage([b], legends=["Furan"])

Can somebody help me please?


Solution

  • You need to explicitly display the output of Draw.MolsToImage :

    from rdkit import Chem
    from rdkit.Chem import Draw
    
    a = Chem.MolFromSmiles("c1cocc1")
    b = Chem.AddHs(a)
    furan = Draw.MolsToImage([b], legends=["Furan"])
    
    furan.show()