-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Fix mujoco_py only installation #3072
Conversation
It is tricky that the test expect an ImportError. But if there is an ImportError, then if MUJOCO_NOT_INSTALLED:
raise error.DependencyNotInstalled(
f"{MUJOCO_IMPORT_ERROR}. (HINT: you need to install mujoco)"
) will be useless. Update: Actually we don't need raise this error during import because |
What test do you mean? If you can solve a way that |
all test import Lines 11 to 31 in 824507b
|
Oh, could you just add a |
@YouJiacheng could you fix the PR? |
I have found a way to fix it: Catch both |
For the catching both errors, see https://stackoverflow.com/questions/6470428/catch-multiple-exceptions-in-one-line-except-block If it is necessary to remove that, then it will be a necessary breaking change |
fc140fb
to
fffc8d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YouJiacheng This looks good, could you fix the pre-commit issues
|
Only import `mujoco_rendering` when `mujoco` installed. Otherwise the `try import` code in `gym.envs.mujoco.mujoco_env` is useless.
fffc8d0
to
40d0251
Compare
Only import
mujoco_rendering
whenmujoco
installed. Otherwise thetry import
code ingym.envs.mujoco.mujoco_env
is useless.Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)