espaloma_charge
espaloma_charge copied to clipboard
Circular import error with example script
Problem
After either installing espaloma_charge
via pip
or conda-forge
, I receive an ImportError
when executing the example script below:
from rdkit import Chem
from espaloma_charge import charge
molecule = Chem.MolFromSmiles("N#N")
The error I receive is the following:
Traceback (most recent call last):
File "/home/marcel/source_rest/espaloma-charge/espaloma_charge.py", line 2, in <module>
from espaloma_charge import charge
File "/home/marcel/source_rest/espaloma-charge/espaloma_charge.py", line 2, in <module>
from espaloma_charge import charge
ImportError: cannot import name 'charge' from partially initialized module 'espaloma_charge' (most likely due to a circular import) (/home/marcel/source_rest/espaloma-charge/espaloma_charge.py)
Is there something I forgot or done wrong during installation?
Installation
In two distinct attempts into empty/new environments, I installed espaloma_charge
as follows (with the same result as described above):
$ mamba create -n espaloma -c conda-forge espaloma_charge
# First create a conda env with mamba, conda, or micromamba
$ mamba create -n espaloma -c conda-forge dgl==1.1.2 pip python
$ mamba activate espaloma
$ pip install espaloma_charge
Side information
Interestingly, the CLI is working, i.e. I can obtain charges for benzene when executing:
espaloma_charge -i benzene.mol2 -o in.crg