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

AttributeError: property 'shape of 'Discrete' object has no setter #758

Open
JohnCThroneberry opened this issue Apr 3, 2024 · 3 comments

Comments

@JohnCThroneberry
Copy link

I don't even know where to start with this...

Traceback (most recent call last):
File "C:\Users\johnc\OneDrive\Documents\GitHub\Video-Pre-Training\run_agent.py", line 4, in
from minerl.herobraine.env_specs.human_survival_specs import HumanSurvival
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl_init_.py", line 6, in
import minerl.herobraine.envs
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl\herobraine\envs.py", line 16, in
MINERL_TREECHOP_V0 = Treechop()
^^^^^^^^^^
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl\herobraine\env_specs\treechop_specs.py", line 33, in init
super().init(
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl\herobraine\env_specs\simple_env_spec.py", line 30, in init
super().init(name, xml, *args, **kwargs)
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl\herobraine\env_spec.py", line 24, in init
self.actionables = self.create_actionables()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl\herobraine\env_specs\simple_env_spec.py", line 43, in create_actionables
handlers.KeyboardAction(k, v) for k,v in INVERSE_KEYMAP.items()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl\herobraine\hero\handlers\actionable.py", line 364, in init
super().init(command, spaces.Discrete(len(keys) + 1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\johnc\AppData\Local\Programs\Python\Python312\Lib\site-packages\minerl\herobraine\hero\spaces.py", line 202, in init
self.shape = ()
^^^^^^^^^^
AttributeError: property 'shape' of 'Discrete' object has no setter

@Miffyli
Copy link
Contributor

Miffyli commented Apr 3, 2024

Hey. Which MineRL version you installed? The one on github ("v1.0" or newer) requires specific (bit older) version of gym. See requirements.txt.

Edit: Also, Python 3.12 might not work with MineRL (not tested). I recommend trying older version like 3.10.

@JohnCThroneberry
Copy link
Author

Reading the gymnasium documentation it appears the backwards compatibility of v0.26.3 might be able to fill in for older versions of gym. Is this something you know of being attempted?

I will try an older Python version as well.

@Miffyli
Copy link
Contributor

Miffyli commented Apr 7, 2024

Newer versions of gym (outside 0.23) do not work because they set some limits on how things should be done (e.g., some fields are read-only), and MineRL made use of that older freedom in the code, so it would require some changes to support newer Gym versions or even Gymnasium. I do not know of people who have tried this, but I would be happy to review a PR on this; however I would want to keep backwards compatibility with older Gym and existing research code :)

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

2 participants