Skip to content

UnpicklingError after import in fresh installation #4

@adrianusler

Description

@adrianusler

I tried installing mace_layer in a fresh virtual environment, following the steps detailed in the Readme.

Subsequently trying to import mace_layer, I get the following error:

>>> import mace_layer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/venv-mace-layer/lib/python3.10/site-packages/mace_layer/__init__.py", line 1, in <module>
    from .mace_layers import MACE_layer
  File "~/venv-mace-layer/lib/python3.10/site-packages/mace_layer/mace_layers.py", line 4, in <module>
    from e3nn import o3
  File "~/venv-mace-layer/lib/python3.10/site-packages/e3nn/o3/__init__.py", line 31, in <module>
    from ._wigner import wigner_D, wigner_3j
  File "~/venv-mace-layer/lib/python3.10/site-packages/e3nn/o3/_wigner.py", line 10, in <module>
    _Jd, _W3j_flat, _W3j_indices = torch.load(os.path.join(os.path.dirname(__file__), 'constants.pt'))
  File "~/venv-mace-layer/lib/python3.10/site-packages/torch/serialization.py", line 1529, in load
    raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint. 
	(1) In PyTorch 2.6, we changed the default value of the `weights_only` argument in `torch.load` from `False` to `True`. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
	(2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.
	WeightsUnpickler error: Unsupported global: GLOBAL slice was not an allowed global by default. Please use `torch.serialization.add_safe_globals([slice])` or the `torch.serialization.safe_globals([slice])` context manager to allowlist this global if you trust this class/function.

I would be grateful for any help on the matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions