You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] tests-optdeps has failed at collection since Sept 25: test_trainer.py imports Hydra unconditionally #4680
The tests-optdeps (3.12, 13.0) job in test-linux.yml has failed on every push to main since 2026-09-25. The last green run was on bc199cd1.
It never gets past collection, so the job has run no tests since then:
ERROR collecting test/test_trainer.py
E ModuleNotFoundError: No module named 'hydra'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
test/test_trainer.py imports hydra.core.config_store.ConfigStore and hydra.utils.instantiate at module level (added with the FQL benchmark commit 5e402a4e, #4459). It also imports FQLLossConfig and FQLTrainerConfig from torchrl.trainers.algorithms.configs, which raises ImportError on purpose when Hydra is missing. The optdeps environment doesn't install Hydra.
E ModuleNotFoundError: No module named 'hydra'!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
no tests collected, 1 error in 0.62s
Expected behavior
test_trainer.py collects without Hydra, and the Hydra-dependent tests are skipped, like the _has_hydra / skipif tests in test/test_configs.py. Then tests-optdeps runs the suite again.
System info
Installed from source (main at 1084821), Python 3.12.10, torch 2.14.1+cpu, tensordict 0.15.4, numpy 2.5.4, win32. The same collection error shows in the Linux tests-optdeps job log on main.
importtorchrl, numpy, sysprint(torchrl.__version__, numpy.__version__, sys.version, sys.platform)
# None 2.5.4 3.12.10 win32 (source checkout, no version file)
Reason and Possible fixes
Use _has_hydra = importlib.util.find_spec("hydra") is not None at module top, import Hydra and the config classes inside the tests that use them, and skip those tests without Hydra.
Once the file collects, TestTdMpc2OptimizationStepper, TestTdMpc2Trainer and TestLogReward::test_log_reward_normalizes_hydra_nested_key also fail without Hydra/omegaconf, because their helpers import Hydra lazily without a skip. They need the same guard.
Activity