Skip to content

Constrain Python 3.12 dependency updates#59

Open
joelaforet wants to merge 1 commit into
timbernat:py312-updatesfrom
joelaforet:py312-dependency-fixes
Open

Constrain Python 3.12 dependency updates#59
joelaforet wants to merge 1 commit into
timbernat:py312-updatesfrom
joelaforet:py312-dependency-fixes

Conversation

@joelaforet

@joelaforet joelaforet commented Jun 8, 2026

Copy link
Copy Markdown

This is a small follow-up to PR #58 based on dependency solver debugging for Python 3.12.

Findings:

  • The source-level Python 3.12 issue is the private importlib.resources._common usage in pkginspect.py; the existing PR fix using ModuleSpec.submodule_search_locations looks correct.
  • Current conda-forge can solve python=3.12 with mbuild + openff-toolkit, and with mbuild-base + openff-toolkit-base. That pair does not appear to be the current hard blocker.
  • The broader test/optional stack has an opposing NumPy constraint: current mbuild pulls gmso>=0.16.1, which requires numpy>=2.0, while espaloma_charge pulls dgl -> tensorflow-base=2.17.0, whose Python 3.12 build requires numpy>=1.26.4,<2.0a0.
  • The saved sequential-install logs in polymerist_py312_context were pinned to python 3.13.*, not 3.12. For this PR, opening requires-python to unbounded >=3.11 makes the solver test future Python versions that are outside the intended compatibility target.

Changes here:

  • Cap Polymerist support to >=3.11,<3.13 for this pass.
  • Remove the pyproject numpy>=2 runtime requirement so Polymerist does not force one side of the mbuild/GMSO vs Espaloma/TensorFlow conflict.
  • Restore setuptools<82 and the unrelated packmol/lammps pins instead of changing them in the Python 3.12 compatibility PR.

Validation run locally:

  • mamba dry-run solve for the updated Python 3.12 runtime dependency set succeeded.
  • mamba dry-run python=3.12 mbuild openff-toolkit succeeded.
  • Focused test: mamba run -n polymerist-env python -m pytest -q polymerist/tests/genutils/importutils/test_pkginspect.py -> 44 passed, 9 xfailed.

@joelaforet joelaforet mentioned this pull request Jun 8, 2026
14 tasks
@joelaforet

Copy link
Copy Markdown
Author

What are your thoughts on deprecating support for Espaloma as a charge model? It appears many of the Python 3.12 env problems are coming from incompatible NumPy/TensorFlow constraints associated with this charger.

Specifically, current mbuild pulls gmso>=0.16, which requires numpy>=2, while espaloma_charge pulls dgl -> tensorflow-base=2.17, which requires numpy<2 on Python 3.12. mbuild + openff-toolkit itself seems to solve fine without that broader Espaloma stack.

From my understanding, we want people using OpenFF NAGL/AshGC now anyway. Maybe the cleanest path is to remove espaloma_charge from the default/test envs, keep EspalomaCharger temporarily as deprecated/backward-compatible, and switch examples/docs toward NAGL.

@joelaforet

Copy link
Copy Markdown
Author

Note, this can be closed should a PR be opened to address #60 . These are the env files I used to get 3.12 working though for reference.

@timbernat timbernat self-assigned this Jun 9, 2026
@timbernat

Copy link
Copy Markdown
Owner

Cap Polymerist support to >=3.11,<3.13 for this pass.

Lower cap makes sense, but why the upper cap at 3.13? Which tests/deps fail without it?

Restore setuptools<82 and the unrelated packmol/lammps pins instead of changing them in the Python 3.12 compatibility PR.

Regrettable these are still needed (was hoping to ditch all upper version pins while rooting around during these updates), but I can confirm polymerist/tests/mdtools/lammpstools/test_lammpseval.py does fail with the same missing Shared Object file Exception as before that pin was added; will add this back on #58 as well.

From my understanding, we want people using OpenFF NAGL/AshGC now anyway. Maybe the cleanest path is to remove espaloma_charge from the default/test envs, keep EspalomaCharger temporarily as deprecated/backward-compatible, and switch examples/docs toward NAGL.

That sounds like a reasonable path forward, as you pointed out in more detail in #60

These are the env files I used to get 3.12 working though for reference.

I don't see any attachments, did you forget to include them? At any rate, apart from verifying that the shipped conda envs YAMLs install, I also want to try to follow a mock pip-install as detailed in this comment, as that will be most useful as a pre-check that a PyPI build will be installable.

@timbernat

timbernat commented Jun 9, 2026

Copy link
Copy Markdown
Owner

As a semi-related small test fix, I noticed the mdtools/openmmtools/test_schedule.py tests failed due to numpy apparently deprecating ndarray.ptp in 2.0 (now must call as np.ptp(arr) instead. I patched that which should increase test coverage in a backwards-compatible way.

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

Successfully merging this pull request may close these issues.

2 participants