Open MicPellegrino opened 1 week ago
update to 3.8 or later, we are going to drop 3.7 support probably, I ll update the setup
I see, thank you.
Hi, I don't think it's python version problem: I tried building a virtual environment with Python 3.8 and I still get the error. On Jupyter:
!python --version
Python 3.8.0
from mace.calculators import mace_mp
TypeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from mace.calculators import mace_mp
File ~/mambaforge/envs/workflow-hea/lib/python3.8/site-packages/mace/calculators/__init__.py:1
----> 1 from .foundations_models import mace_anicc, mace_mp, mace_off
2 from .lammps_mace import LAMMPS_MACE
3 from .mace import MACECalculator
File ~/mambaforge/envs/workflow-hea/lib/python3.8/site-packages/mace/calculators/foundations_models.py:10
7 from ase import units
8 from ase.calculators.mixing import SumCalculator
---> 10 from .mace import MACECalculator
12 module_dir = os.path.dirname(__file__)
13 local_model_path = os.path.join(
14 module_dir, "foundations_models/2023-12-03-mace-mp.model"
15 )
File ~/mambaforge/envs/workflow-hea/lib/python3.8/site-packages/mace/calculators/mace.py:35
31 return "float32"
32 raise ValueError(f"Unknown dtype {mode_dtype}")
---> 35 class MACECalculator(Calculator):
36 """MACE ASE Calculator
37 args:
38 model_paths: str, path to model or models if a committee is produced
(...)
48 Dipoles are returned in units of Debye
49 """
51 def __init__(
52 self,
53 model_paths: Union[list, str, None] = None,
(...)
63 **kwargs,
64 ):
File ~/mambaforge/envs/workflow-hea/lib/python3.8/site-packages/mace/calculators/mace.py:54, in MACECalculator()
35 class MACECalculator(Calculator):
36 """MACE ASE Calculator
37 args:
38 model_paths: str, path to model or models if a committee is produced
(...)
48 Dipoles are returned in units of Debye
49 """
51 def __init__(
52 self,
53 model_paths: Union[list, str, None] = None,
---> 54 models: Union[list[torch.nn.Module], torch.nn.Module, None] = None,
55 device: str = "cpu",
56 energy_units_to_eV: float = 1.0,
57 length_units_to_A: float = 1.0,
58 default_dtype="",
59 charges_key="Qs",
60 model_type="MACE",
61 compile_mode=None,
62 fullgraph=True,
63 **kwargs,
64 ):
65 Calculator.__init__(self, **kwargs)
67 if "model_path" in kwargs:
TypeError: 'type' object is not subscriptable
try 3.10?
Could it be that some pytorch
requirement is missing instead?
no I don't think so, I know the bug, it is the use of list
instead of the typing List
... I know that this works for 3.10 and later, not sure if it works for 3.9.
Ok, it worked by specifying python>=3.10
in the environment .yml
file (got Python 3.12.7
).
https://github.com/ACEsuit/mace/pull/537#issuecomment-2269588751 the list
List
issue can be resolved with this future import (which in the ruff PR linked was added as an automatic fix).
Describe the bug I cannot load the mace_mp calculator by running
from mace.calculators import mace_mp
. I'm getting:To Reproduce Run
from mace.calculators import mace_mp
in Python3.7 (which should be compatible according to https://pypi.org/project/mace-torch/)Desktop (please complete the following information):