Skip to content

[BugFix] Changing the dm_control import to fail if not installed #515

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

Merged
merged 3 commits into from
Oct 5, 2022

Conversation

zeenolife
Copy link
Contributor

Description

This PR handles the import of the torchrl.envs.libs.dm_control, when the dm_control library is not installed. Specifically, it raises the ImportError.

Motivation and Context

close #506

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read the CONTRIBUTION guide (required)
  • ? My change requires a change to the documentation.
  • ? I have updated the tests accordingly (required for a bug fix or a new feature).
  • ? I have updated the documentation accordingly.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 4, 2022
raise ImportError(
"dm_control python package was not found."
"Please install this dependency."
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to check it with _has_dmc compared to self.available_envs, because it's easier to track why _has_dmc is False

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're absolutely right!

Copy link
Collaborator

@vmoens vmoens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for this, let's wait a couple of minutes for the tests to pass

@zeenolife zeenolife changed the title [DRAFT] Changing the dm_control import to fail if not installed [BugFix] Changing the dm_control import to fail if not installed Oct 5, 2022
@vmoens vmoens added the bug Something isn't working label Oct 5, 2022
@vmoens vmoens merged commit d194735 into pytorch:main Oct 5, 2022
silvestrebahi pushed a commit to silvestrebahi/rl that referenced this pull request Oct 6, 2022
…orch#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
silvestrebahi pushed a commit to silvestrebahi/rl that referenced this pull request Oct 7, 2022
silvestrebahi pushed a commit to silvestrebahi/rl that referenced this pull request Oct 7, 2022
vmoens added a commit that referenced this pull request Oct 7, 2022
* add orb decov to circleci config.yml

* Add codecov badge to Readme

* Revert "[BugFix] Changing the dm_control import to fail if not installed (#515)"

This reverts commit d194735.

* codecov coverage w/o orb in circleci

* Revert "Revert "[BugFix] Changing the dm_control import to fail if not installed (#515)""

This reverts commit d0dc7de.

* [CI] generation of coverage reports (#534)

* update test scripts to add coverage

* update test scripts to add coverage

Co-authored-by: Silvestre Bahi <silvestrebahi@fb.com>

* [CI] Add xml coverage reports for codecov (#537)

* update test scripts to add coverage

* update test scripts to add coverage

* generate xml file for coverage

* Update run_test.sh

lint end of file

* Update run_test.sh

lint end of file

* Update run_test.sh

lint end of file

Co-authored-by: Silvestre Bahi <silvestrebahi@fb.com>

* permissions

* permissions

Co-authored-by: Silvestre Bahi <silvestrebahi@fb.com>
Co-authored-by: silvestrebahi <silvestre.bahi@gmail.com>
vmoens added a commit that referenced this pull request Oct 13, 2022
* [BugFix] Transformed ParallelEnv meta data are broken when passing to device (#531)

* [Doc] Add coverage banner (#533)

* add orb decov to circleci config.yml

* Add codecov badge to Readme

* Revert "[BugFix] Changing the dm_control import to fail if not installed (#515)"

This reverts commit d194735.

* codecov coverage w/o orb in circleci

* Revert "Revert "[BugFix] Changing the dm_control import to fail if not installed (#515)""

This reverts commit d0dc7de.

* [CI] generation of coverage reports (#534)

* update test scripts to add coverage

* update test scripts to add coverage

Co-authored-by: Silvestre Bahi <silvestrebahi@fb.com>

* [CI] Add xml coverage reports for codecov (#537)

* update test scripts to add coverage

* update test scripts to add coverage

* generate xml file for coverage

* Update run_test.sh

lint end of file

* Update run_test.sh

lint end of file

* Update run_test.sh

lint end of file

Co-authored-by: Silvestre Bahi <silvestrebahi@fb.com>

* permissions

* permissions

Co-authored-by: Silvestre Bahi <silvestrebahi@fb.com>
Co-authored-by: silvestrebahi <silvestre.bahi@gmail.com>

* [BugFix] Fix colab link of coding_dqn.ipynb (#543)

* [BugFix] Fix optional imports (#535)

* [BugFix] Restore missing keys in data collector output (#521)

* Ensure data collectors return all expected keys

* Rerun CI

* Add tests

* Format code

* correct unreachable test

* Fix broken test

* WIP: fix initialisation with policy + test

* Fix initialisation with policy + test

* Reset env after rollout initialisation

* fix build from spec

* Check policy has spec attribute before accessing

* Address comments

Co-authored-by: vmoens <vincentmoens@gmail.com>

* [Lint] reorganize imports (#545)

[Lint] reorganize imports

* [BugFix] Single-cpu compatibility (#548)

* [BugFix] vision install and other deps in optdeps (#552)

* init

* amend

* amend

* amend

* [Feature] Implemented device argument for modules.models (#524)

Co-authored-by: Yu Shiyang <yushiyang@fb.com>

* [BugFix] Fix ellipsis indexing of 2d TensorDicts (#559)

* [BugFix] Additive gaussian exploration spec fix (#560)

* [BugFix] Disabling video step for wandb (#561)

* [BugFix] Various device fix (#558)

* [Feature] Allow collectors to accept regular modules as policies (#546)

* [BugFix] Fix push binary nightly action (#566)

Fix Push Binary Nightly Action for linux hosts

Co-authored-by: Vincent Moens <vincentmoens@gmail.com>
Co-authored-by: Silvestre Bahi <silvestrebahi@fb.com>
Co-authored-by: silvestrebahi <silvestre.bahi@gmail.com>
Co-authored-by: Bo Liu <benjaminliu.eecs@gmail.com>
Co-authored-by: Tom Begley <tomcbegley@gmail.com>
Co-authored-by: Alessandro Pietro Bardelli <apbard@users.noreply.github.com>
Co-authored-by: Yu Shiyang <yushiyangk@users.noreply.github.com>
Co-authored-by: Yu Shiyang <yushiyang@fb.com>
Co-authored-by: Pavel Solikov <psolikov15@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] importing dm_control environments when the library is not installed does not display the right error message
3 participants