Skip to content

Fix ImportError: Cannot import experiments from acme.jax#350

Open
natinew77-creator wants to merge 1 commit intogoogle-deepmind:masterfrom
natinew77-creator:fix/import-experiments-issue-335
Open

Fix ImportError: Cannot import experiments from acme.jax#350
natinew77-creator wants to merge 1 commit intogoogle-deepmind:masterfrom
natinew77-creator:fix/import-experiments-issue-335

Conversation

@natinew77-creator
Copy link

Summary

Fixes #335

The experiments submodule was not exposed in acme/jax/__init__.py, causing from acme.jax import experiments to fail with an ImportError when users install Acme via pip.

Problem

Users following the quickstart tutorial encounter this error:

from acme.jax import experiments
# ImportError: cannot import name 'experiments' from 'acme.jax'

Root Cause

The acme/jax/experiments/ submodule exists with a proper __init__.py that exports all necessary classes (ExperimentConfig, run_experiment, etc.). However, the parent module acme/jax/__init__.py was empty and didn't expose the experiments submodule.

Solution

Added the missing import statement to acme/jax/__init__.py:

"""JAX-specific components for Acme."""

# Expose the experiments submodule.
from acme.jax import experiments

Impact

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

Testing

  • Verified syntax is valid with python3 -m py_compile
  • The fix follows the same pattern used in acme/__init__.py for exposing submodules

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
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.

ImportError: Cannot Import experiments from acme.jax

1 participant