Skip to content
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

Roulette-v0 step function fails with numpy.random._generator.Generator' object has no attribute 'randint' #4

Open
rogermc2 opened this issue May 23, 2023 · 0 comments

Comments

@rogermc2
Copy link

rogermc2 commented May 23, 2023

Mac OSX 13.4 Ventura
XCode 14.3
Python3.11

Perhaps I'm using the wrong gym version?
If so, how do I find out which version is installed and how to install the correct one?
Thanks for any assistance.

gym.version
<module 'gym.version' from '/usr/local/lib/python3.11/site-packages/gym/version.py'>
gym_toytext
<module 'gym_toytext' from '/usr/local/lib/python3.11/site-packages/gym_toytext/init.py'>

I'm trying to build a Roulette program but self.env.step(action) fails.
Below is a simplified version:

import gym
import gym_toytext

env=gym.make("Roulette-v0")
observation, info = env.reset()
observation
0
action=0
observation, reward, termination, truncation, info = env.step(action)

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.11/site-packages/gym/wrappers/time_limit.py", line 50, in step
observation, reward, terminated, truncated, info = self.env.step(action)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gym/wrappers/order_enforcing.py", line 37, in step
return self.env.step(action)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gym/wrappers/env_checker.py", line 37, in step
return env_step_passive_checker(self.env, action)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gym/utils/passive_env_checker.py", line 214, in env_step_passive_checker
result = env.step(action)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gym_toytext/roulette.py", line 34, in step
val = self.np_random.randint(0, self.n - 1)
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'numpy.random._generator.Generator' object has no attribute 'randint'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant