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

Resolve incompatibility between imp and the DeferredImportCallbackFinder #3444

Merged
merged 4 commits into from
Dec 6, 2024

Conversation

jsiirola
Copy link
Member

@jsiirola jsiirola commented Dec 5, 2024

Fixes # .

Summary/Motivation:

IDAES identified an incompatibility with Pyomo's DeferredImportCallbackFinder and the (deprecated) imp module. Finders from that module lack a find_spec method and instead use a find_module method.

This came up because Google Collab defines imp-style finders, which was causing errors: https://ndcbe.github.io/optimization/notebooks/7/degeneracy_hunter.html

Changes proposed in this PR:

  • Support deferring to both imp and importlib style finders
  • Add testing for Pyomo's callback hooks

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@lbianchi-lbl
Copy link

lbianchi-lbl commented Dec 5, 2024

I tested the notebook (static link, Colab link) where the issue was originally noticed, making sure a new "runtime" (container instance) was used each time.

Without the fix (Pyomo 6.8.2)

2024-12-05_11-27

With the fix (installing Pyomo from this PR's head branch before importing it)

2024-12-05_11-24

@jsiirola jsiirola merged commit 6f36384 into Pyomo:main Dec 6, 2024
34 checks passed
@jsiirola jsiirola deleted the imp-finder-compat branch December 6, 2024 15:36
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.

3 participants