facebookresearch/minihack

[BUG] Error creating environment or running mh-play (Mac OSX 12.6)

Closed this issue ยท 5 comments

๐Ÿ› Bug

Can't create environment or run play scripts in MacOSX 12.6

To Reproduce

Steps to reproduce the behavior:

  1. Install NLE 0.8.1 following workaround at facebookresearch/nle#340
  2. pip install minihack
  3. mh-play leads to error: AttributeError: 'MiniHackRoom5x5Random' object has no attribute 'env'
  4. python -m minihack.scripts.play --env MiniHack-River-v0 --mode random leads to similar error: AttributeError: 'MiniHackRiver' object has no attribute 'env'

Expected behavior

Environment created successfully

Environment

MiniHack version: 0.1.2
NLE version: 0.8.1+103c667
Gym version: 0.21.0
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: Mac OSX 12.6
GCC version: Could not collect
CMake version: version 3.24.2

Python version: 3.8
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.23.3
[conda] Could not collect

Additional context

Used workaround for NLE install described here: facebookresearch/nle#340
nle-play works as expected
mh-env returns list of environments as expected.
Same error encountered with python 3.9 & 3.10, and minihack version 0.1.3 (not tested all combinations)

Hi @tmssmith. Thanks for opening the PR!

Could you please try the same with gym==0.1.6 version? We have downgraded the gym version here. to resolve an issue we were getting.

I have just tested locally (OSX 12.6) with MiniHack 0.1.3+ (from the github) py 3.8.10 and NLE 0.8.1 and it worked as expected.

Hi @samvelyan, thanks for your reply and looking into this. Just to clarify I assume you mean try gym==0.16? Unfortunately I'm still having trouble with gym 0.16 and MiniHack 0.1.3+ .

If it makes any difference I'm using poetry for dependency management. I don't see why it should, but just in case. My dependencies are:
python = "3.8.10"
gym = "0.16"
nle = {path = "nle"}
minihack = {path = "minihack"}

where nle and minihack point to respective git clone directories.


Latest environment info:

MiniHack version: 0.1.3+39a3cae
NLE version: 0.8.1+103c667
Gym version: 0.16.0
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A

OS: Mac OSX 12.6
GCC version: Could not collect
CMake version: version 3.24.2

Python version: 3.8
Is CUDA available: N/A
CUDA runtime version: Could not collect
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.23.4
[conda] Could not collect

nle-play and mh-envs still work correctly but the same error with mh-play.

Okay, I can see the issue.

You're using the current version of NLE, which includes changes to its base class that are not included in the last release v0.8.1 which we use in MiniHack. Specifically, the .env variable is renamed to .nethack on the nle side, see the diff here.

So you can use minihack without any problem if you just use the v0.8.1 nle tag. Alternatively, you can use the current nle version (in case you're using any of the recent changes), but locally change the minihack's base.py class to use self.nethack instead of self.env.

Let me know if this works.

Yes that worked, thank you very much. I had issues installing the v0.8.1 nle tag (cmake errors) so locally modified minihack's base.py as suggested instead.

In case this helps you or anyone else: I also had to modify play.py to use env.actions instead of env._actions for the script to work. I suspect a similar change would be required for play_gui.py

Thanks again for all your help.

Yes, thanks for pointing this out @tmssmith. The env.action, similarly, needs to be fixed.

Anyway, we expect a new release of nle soon. Once that happens, I'll apply necessary changes on the minihack side and release minihack=0.1.4 which should resolve this issue for good.