Skip to content

Commit d194735

Browse files
authored
[BugFix] Changing the dm_control import to fail if not installed (#515)
* Changing the dm_control import to fail if not installed. Initial commit * Moving import check to init of the object * Cleaning up initial commit
1 parent 5fc3b7c commit d194735

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

torchrl/envs/libs/dm_control.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ class DMControlEnv(DMControlWrapper):
272272
"""
273273

274274
def __init__(self, env_name, task_name, **kwargs):
275+
if not _has_dmc:
276+
raise ImportError(
277+
"dm_control python package was not found."
278+
"Please install this dependency."
279+
)
275280
kwargs["env_name"] = env_name
276281
kwargs["task_name"] = task_name
277282
super().__init__(**kwargs)

0 commit comments

Comments
 (0)