Repository navigation
Description
Summary
skala declares e3nn with no version bound, so a resolver is free to install e3nn < 0.5. Under torch >= 2.6 that combination makes skala unimportable. Nothing warns at install time — pip/uv report success, and the failure only surfaces at import skala.pyscf.
Reproduction
uv venv .venv --python 3.11
uv pip install --python .venv/bin/python "skala==2026.8" "e3nn==0.4.4"
.venv/bin/python -c "from skala.pyscf import SkalaKS"Traceback (most recent call last):
File "<string>", line 1, in <module>
File ".../site-packages/skala/pyscf/__init__.py", line 17, in <module>
from skala.functional import ExcFunctionalBase, load_functional
File ".../site-packages/skala/functional/__init__.py", line 20, in <module>
from skala.functional.model import SkalaFunctional
File ".../site-packages/skala/functional/model.py", line 15, in <module>
from e3nn import o3
File ".../site-packages/e3nn/o3/__init__.py", line 31, in <module>
from ._wigner import wigner_D, wigner_3j
File ".../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 ".../site-packages/torch/serialization.py", line 1609, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. [...]
WeightsUnpickler error: Unsupported global: GLOBAL slice was not an allowed global by default.
Please use `torch.serialization.add_safe_globals([slice])` [...]
Root cause
pyproject.tomllists"e3nn"with no specifier, soe3nn 0.4.4satisfies the requirement.e3nn 0.4.4loads its own Wigner constants at import time, ine3nn/o3/_wigner.py:10, viatorch.load(...'constants.pt')without passingweights_only.- PyTorch 2.6 flipped the default of
weights_onlyfromFalsetoTrue.sliceis not on the default allowlist, so the load raisesUnpicklingError. e3nn >= 0.5is unaffected — it droppedconstants.ptand computes the Wigner matrices analytically, so there is notorch.loadon the import path at all.
How you actually end up on e3nn 0.4.4
Not by choice. mace-torch (0.3.16, current release) hard-pins it:
Requires-Dist: e3nn==0.4.4
and that pin is load-bearing for MACE — its pretrained weights are serialized with the 0.4.4 codegen format and e3nn >= 0.5 cannot read them. So in any environment where skala and mace-torch are co-installed — a natural combination when benchmarking a learned functional against MLIPs — the resolver silently pulls e3nn down to 0.4.4 and skala stops importing.
The resulting failure is import-order dependent, which makes it look flaky. mace/__init__.py:5 sets os.environ["TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD"] = "1" as a global side effect, which reverts the torch.load default process-wide. Same venv, same packages, only statement order differs:
from skala.pyscf import SkalaKS # UnpicklingError
import maceimport mace # sets TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1
from skala.pyscf import SkalaKS # imports fineSo whether skala works depends on whether something else happened to import mace first.
Suggested fix
- "e3nn",
+ "e3nn>=0.5",The goal isn't only to land on a working e3nn. With a lower bound present, the resolver reports the conflict against mace-torch loudly at install time, instead of producing an environment that installs cleanly and then fails at import — or worse, one that works or not depending on import order.
The bump appears numerically inert. Same molecule, same basis, same functional, only e3nn differs:
| e3nn | from skala.pyscf import SkalaKS |
H2O / def2-SVP / skala-1.1 |
|---|---|---|
| 0.4.4 | UnpicklingError |
— |
| 0.6.0 | ok | -76.32239149 Ha |
-76.32239149 Ha is bit-identical to what I get on e3nn 0.4.4 with torch.serialization.add_safe_globals([slice]) applied before import, so the constraint change doesn't move any numbers.
If you would rather be conservative than open-ended, e3nn>=0.5,<0.7 would also work — I only tested 0.5.9 and 0.6.0.
Workaround for anyone who has to keep e3nn 0.4.4
For the mace-torch co-install case, allowlisting the one global that constants.pt needs is enough, and doesn't require MACE's process-wide env var:
import torch.serialization
torch.serialization.add_safe_globals([slice]) # before importing skala or e3nn
from skala.pyscf import SkalaKSEnvironment
- Python 3.11.15, macOS 26.6.1, arm64 (Apple silicon)
skala2026.8,torch2.13.0,pyscf2.13.1,numpy2.4.6,ase3.29.0mace-torch0.3.16 for the co-install case
Happy to send a PR for the constraint if you agree with the bound.
Activity
JensWehner commentedon Aug 17, 2026
thanks, that is a very nice description and we are happy with a PR on this. Thanks a lot!
JensWehner commentedon Oct 4, 2026
fixed in #137