openforcefield / openff-toolkit

The Open Forcefield Toolkit provides implementations of the SMIRNOFF format, parameterization engine, and other tools. Documentation available at http://open-forcefield-toolkit.readthedocs.io
http://openforcefield.org
MIT License
311 stars 90 forks source link

Cannot find openff.units while loading the molecule class. #1765

Closed subhamoymahajan closed 10 months ago

subhamoymahajan commented 11 months ago

Describe the bug The package fails to load Molecule class from openff.toolkit.topology

To Reproduce from openff.toolkit.topology import Molecule

Output Traceback (most recent call last): File "/lustre/eaglefs/scratch/subhamoy/FFgen/test.py", line 1, in from openff.toolkit.topology import Molecule File "/home/subhamoy/.conda-envs/FFgen/lib/python3.12/site-packages/openff_toolkit-0.14.4+12.g575501a2-py3.12.egg/openff/toolkit/topology/init.py", line 1, in from openff.toolkit.topology.molecule import ( File "/home/subhamoy/.conda-envs/FFgen/lib/python3.12/site-packages/openff_toolkit-0.14.4+12.g575501a2-py3.12.egg/openff/toolkit/topology/molecule.py", line 54, in from openff.units import Quantity, unit ModuleNotFoundError: No module named 'openff.units'

Computing environment (please complete the following information):

Additional context I have used the main branch.

mattwthompson commented 11 months ago

How did you install the toolkit? You're missing most dependencies, so I doubt you installed the conda package. Here's how we recommend installing a fresh environment, and

$ mamba install openff-toolkit -c conda-forge

usually works into an existing environment.

subhamoymahajan commented 10 months ago

I was unable to install it using conda, so I used git clone and python setup.py install to install openff-toolkit.

I think the problem would still persists because openff.units is not defined. Is a specific version of openff-toolkit working for you that I can test ?

subhamoymahajan commented 10 months ago

In openff/toolkit/topology/molecule.py line 60,

from openff.toolkit.utils.constants import DEFAULT_AROMATICITY_MODEL . Correspondingly, constants.py exists at openff/toolkit/utils. However, for line 54,

from openff.units import Quantity, unit, openff has no file named units.py. So i feel installing an older version where the file still exists would work.

mattwthompson commented 10 months ago

Please use the documented installation methods I linked above; local installations do not bring in dependencies and is not supported due to the extra, unnecessary dependency management burden that is passed on to users.

subhamoymahajan commented 10 months ago

Mamba installation worked for me. Thanks.