Fix ImportError: Cannot import experiments from acme.jax#350
Open
natinew77-creator wants to merge 1 commit intogoogle-deepmind:masterfrom
Open
Fix ImportError: Cannot import experiments from acme.jax#350natinew77-creator wants to merge 1 commit intogoogle-deepmind:masterfrom
natinew77-creator wants to merge 1 commit intogoogle-deepmind:masterfrom
Conversation
The experiments submodule was not exposed in acme/jax/__init__.py, causing 'from acme.jax import experiments' to fail with an ImportError. This import pattern is used in: - The quickstart tutorial (examples/quickstart.ipynb) - All baseline example scripts (rl_continuous, rl_discrete, imitation) - 21+ files throughout the codebase The fix adds the missing import statement to expose the experiments submodule from the acme.jax namespace. Fixes google-deepmind#335
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #335
The
experimentssubmodule was not exposed inacme/jax/__init__.py, causingfrom acme.jax import experimentsto fail with anImportErrorwhen users install Acme via pip.Problem
Users following the quickstart tutorial encounter this error:
Root Cause
The
acme/jax/experiments/submodule exists with a proper__init__.pythat exports all necessary classes (ExperimentConfig,run_experiment, etc.). However, the parent moduleacme/jax/__init__.pywas empty and didn't expose theexperimentssubmodule.Solution
Added the missing import statement to
acme/jax/__init__.py:Impact
This import pattern is used in:
examples/quickstart.ipynb)Testing
python3 -m py_compileacme/__init__.pyfor exposing submodules