Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular import error with example script #41

Open
marcelmbn opened this issue Jul 2, 2024 · 0 comments
Open

Circular import error with example script #41

marcelmbn opened this issue Jul 2, 2024 · 0 comments

Comments

@marcelmbn
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant