Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to refactor perses and dependencies to replace import simtk.openmm with import openmm #837

Closed
zhang-ivy opened this issue Aug 5, 2021 · 12 comments
Assignees
Labels
priority: low low priority

Comments

@zhang-ivy
Copy link
Contributor

zhang-ivy commented Aug 5, 2021

I'm using the nightly dev version of OpenMM (necessary to parametrize glycosylated systems) and getting this error when I try to run from perses.app.relative_point_mutation_setup import PointMutationExecutor:

~/miniconda3/envs/perses-rbd-ace2-direct/lib/python3.8/site-packages/perses-0.9.1-py3.8.egg/perses/app/relative_point_mutation_setup.py in <module>
      3 from perses.utils.openeye import createOEMolFromSDF, extractPositionsFromOEMol
      4 from perses.annihilation.relative import HybridTopologyFactory, RepartitionedHybridTopologyFactory
----> 5 from perses.rjmc.topology_proposal import PointMutationEngine
      6 from perses.rjmc.geometry import FFAllAngleGeometryEngine
      7 

~/miniconda3/envs/perses-rbd-ace2-direct/lib/python3.8/site-packages/perses-0.9.1-py3.8.egg/perses/rjmc/__init__.py in <module>
----> 1 from perses.rjmc import geometry, coordinate_numba, coordinate_tools, topology_proposal

~/miniconda3/envs/perses-rbd-ace2-direct/lib/python3.8/site-packages/perses-0.9.1-py3.8.egg/perses/rjmc/topology_proposal.py in <module>
     11 import numpy as np
     12 import networkx as nx
---> 13 import openmoltools.forcefield_generators as forcefield_generators
     14 from perses.storage import NetCDFStorageView
     15 from perses.rjmc.geometry import NoTorsionError

~/miniconda3/envs/perses-rbd-ace2-direct/lib/python3.8/site-packages/openmoltools/__init__.py in <module>
     24 """
     25 
---> 26 from openmoltools import amber_parser, system_checker, utils, packmol, openeye, amber, cirpy, gromacs, schrodinger

~/miniconda3/envs/perses-rbd-ace2-direct/lib/python3.8/site-packages/openmoltools/amber_parser.py in <module>
      2 import sys
      3 import math
----> 4 import simtk.openmm.app.element as element
      5 import simtk.unit as unit
      6 import subprocess

ModuleNotFoundError: No module named 'simtk.openmm.app.element'

When the next version of OpenMM is released, we'll need to refactor perses and dependencies (like openmoltools) to use the new way of importing openmm.

@mikemhenry
Copy link
Contributor

mikemhenry commented Aug 5, 2021

We have updated openmoltools but have not cut a new release yet, choderalab/openmoltools#304
You will need to install from source, like pip install --upgrade git+https://github.com/choderalab/openmoltools.git and you should be good to go.

Since we test perses against nightly, we know it will work with the nightly release, but it does require some different software:
https://github.com/choderalab/perses/blob/master/.github/workflows/CI.yaml#L67-L69
You will need to update parmed as well:
pip install --upgrade git+https://github.com/ParmEd/ParmEd.git

@zhang-ivy
Copy link
Contributor Author

This worked, thanks! Should we keep this issue open as a reminder to refactor perses openmm imports?

@jchodera
Copy link
Member

jchodera commented Aug 5, 2021

This worked, thanks! Should we keep this issue open as a reminder to refactor perses openmm imports?

The only import we need to worry about is

import simtk.openmm.app.element as element

which should become

from openmm.app import Element

and then element.Element should just become Element in the code. This works with both new and old OpenMM.

Future refactoring to completely eliminate simtk.openmm is low priority.

@mikemhenry
Copy link
Contributor

I don't think there is really anything we can do, perses imports openmm correctly with the new namespace, the error comes from our dependencies which have been updated but just not released yet. I've got this issue #798 to keep track of when we can drop those steps in the CI.

Or is there a different issue your seeing with the openmm imports?

@mikemhenry
Copy link
Contributor

This worked, thanks! Should we keep this issue open as a reminder to refactor perses openmm imports?

The only import we need to worry about is

import simtk.openmm.app.element as element

which should become

from openmm.app import Element

Those imports are not happening in perses but in openmoltools which has been updated, just no new release cut.

@zhang-ivy
Copy link
Contributor Author

zhang-ivy commented Aug 5, 2021

perses imports openmm correctly with the new namespace

I'm not totally sure this is true.
When I run (with the nightly dev version of OpenMM):

>>> from simtk.openmm import app
Warning: importing 'simtk.openmm' is deprecated.  Import 'openmm' instead.

I agree with John that this is a low priority issue, so I'll mark it as such

@zhang-ivy zhang-ivy added the priority: low low priority label Aug 5, 2021
@jchodera
Copy link
Member

jchodera commented Aug 6, 2021

I'm not totally sure this is true.
When I run (with the nightly dev version of OpenMM):

That's a warning we put in that this will eventually change, but we don't have a plan to remove support for simtk.openmm yet.

@mikemhenry
Copy link
Contributor

At one point removing this style of import would break on the openmm version that we supported. Now that we use openmm >= 7.5 we could change this, but with finite dev effort it will be better to work on this later.

@zhang-ivy
Copy link
Contributor Author

with finite dev effort it will be better to work on this later.

Yes definitely. Was just raising this issue so that we don't forget, but definitely will not need this anytime soon, especially since John mentioned there are no plans to remove support for simtk.openmm!

@jchodera
Copy link
Member

@zhang-ivy @ijpulidos @mikemhenry : Was this already addressed?

@mikemhenry
Copy link
Contributor

Yes, we can close this issue.

@mikemhenry
Copy link
Contributor

mikemhenry commented Nov 21, 2021

We are running 7.5, 7.6, and nightly in CI and tests are passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low low priority
Projects
None yet
Development

No branches or pull requests

4 participants