Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Update passive_env_checker.py to fix "bool8 error"#3310

Open
JilinJL wants to merge 1 commit into
openai:masterfrom
JilinJL:pr#3258
Open

Update passive_env_checker.py to fix "bool8 error"#3310
JilinJL wants to merge 1 commit into
openai:masterfrom
JilinJL:pr#3258

Conversation

@JilinJL
Copy link
Copy Markdown

@JilinJL JilinJL commented Mar 11, 2025

fix the bool8 error
bool8 -> bool

I have tested the change and made sure it runs well

Description

Running the demo code in DemoCode export an error

Code example

import gym
env = gym.make("LunarLander-v2", render_mode="human")
env.action_space.seed(42)

observation, info = env.reset(seed=42)

for _ in range(1000):
    observation, reward, terminated, truncated, info = env.step(env.action_space.sample())

    if terminated or truncated:
        observation, info = env.reset()

env.close()

System Info

File "E:\learn.venv\Lib\site-packages\gym\utils\passive_env_checker.py", line 233, in env_step_passive_checker
if not isinstance(terminated, (bool, np.bool8)):
^^^^^^^^
File "E:\learn.venv\Lib\site-packages\numpy_init_.py", line 427, in getattr
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?
libpng warning: iCCP: cHRM chunk does not match sRGB

Additional context
I edited the source code to ensure that the code can be run.Maybe there is a version problem here.

Checklist

  • I have checked that there is no similar issue in the repo (required)
    In fact, there is a similar PR, but it seems to have expired

Fixes #3258 #3294

Type of change

Please delete options that are not relevant.

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

Screenshots

Please attach before and after screenshots of the change if applicable.

Before ❌ After ✔
image image

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • [x ] New and existing unit tests pass locally with my changes

fix the bool8 error
bool8 -> bool

**I have tested the change and made sure it runs well**
@JilinJL
Copy link
Copy Markdown
Author

JilinJL commented Mar 11, 2025

As of 3.11.2025, the code works!

@pseudo-rnd-thoughts
Copy link
Copy Markdown
Contributor

Hey, the dev team launched gymnasium, a fork of Gym by the maintainers where all maintenance and improvements will happen moving forward. Therefore, we are not updating or maintaining this repo anymore

@JilinJL
Copy link
Copy Markdown
Author

JilinJL commented Mar 11, 2025

Oh, My God. My first PR, BAD ENDING. sorry!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants