Open mol file error

I had a python script where I try to import a molecule from a mol file:
mol = Molecule.from_file(‘YINRAQ_0.mol’)

This used to work but I changed my conda environment after the latest CSD release and now this line returns the following error. I do not know how to fix this or what is causing the error. I have double checked that the file exists. I’ve tried reverting back to the version of pymatgen I used but it was from the matsci channel which nolonger works.

Traceback (most recent call last):

File “C:\Users\mjkiwsw4\Python_Scripts\Vasp\EthylAcetate_Solvates\supercell\YINRAQ\”, line 13, in
mol = Molecule.from_file(‘YINRAQ_0.mol’)

File “C:\Users\mjkiwsw4\AppData\Local\Continuum\anaconda3\envs\CSD-env\lib\site-packages\pymatgen\core\”, line 2895, in from_file

File “C:\Users\mjkiwsw4\AppData\Local\Continuum\anaconda3\envs\CSD-env\lib\site-packages\pymatgen\io\”, line 319, in from_file
mols = pb.readfile(str(file_format), str(filename))

AttributeError: ‘NoneType’ object has no attribute ‘readfile’

Hi @SarahEW,

I suspect you may not have Open Babel (or perhaps “pybel”) installed? This is a dependency of pymatgen, meaning that it has to be installed for some parts of pymatgen to work correctly.

I’m not current on the easiest way to install these, perhaps conda will work. We’re trying to move away from Open Babel particularly because it can be difficult to install. If you had your molecules in e.g. xyz format instead of mol format this would not require Open Babel.