minerllabs / minerl

MineRL Competition for Sample Efficient Reinforcement Learning - Python Package
http://minerl.io/docs/
Other
654 stars 151 forks source link

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

Open JohnCThroneberry opened 2 months ago

JohnCThroneberry commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 :)