Closed Valaybundele closed 2 years ago
Thanks for the issue, I have contacted one of the devs for BabyAI and they are going to make a release to fix this. Uncertain of the timeline for the fix but they are aware
Hi @pseudo-rnd-thoughts,
Thanks for the quick reply. I understand that it might take time and so I was just wondering if I could get the older version of gym-minigrid repo somewhere so that I could continue with my experimentation. Please let me know if this is possible.
Thanks
The easiest way is to probably clone this repo, and add to the envs/__init__.py
to import from gym_minigrid.minigrid import Ball, Key, Box
and this should work now
Hi @pseudo-rnd-thoughts, Thanks for the quick fix. I added the line from gym_minigrid.minigrid import Ball, Key, Box
in babyai/babyai/levels/bonus_levels.py
and I was able to import babyai successfully. But now when I am trying to make a new BabyAI environment, I am getting this error:
import babyai from gym_minigrid.wrappers import RGBImgPartialObsWrapper, ImgObsWrapper env = gym.make('BabyAI-GoToLocal-v0') Traceback (most recent call last): File "
", line 1, in File "/home/biplab/anaconda3/envs/babyai/lib/python3.7/site-packages/gym/envs/registration.py", line 674, in make raise e File "/home/biplab/anaconda3/envs/babyai/lib/python3.7/site-packages/gym/envs/registration.py", line 662, in make env = env_creator(_kwargs) File "/home/biplab/Valay/babyai/babyai/levels/iclr19_levels.py", line 116, in init seed=seed File "/home/biplab/Valay/babyai/babyai/levels/levelgen.py", line 32, in init kwargs File "/home/biplab/anaconda3/envs/babyai/lib/python3.7/site-packages/gym_minigrid/roomgrid.py", line 96, in init **kwargs, TypeError: init() missing 1 required positional argument: 'mission_space'
I also tried adding mission_space='GoToLocal' in anaconda3/envs/babyai/lib/python3.7/site-packages/gym_minigrid/roomgrid.py"
but I am still getting this error :
env = gym.make('BabyAI-GoToLocal-v0') Traceback (most recent call last): File "
", line 1, in File "/home/biplab/anaconda3/envs/babyai/lib/python3.7/site-packages/gym/envs/registration.py", line 674, in make raise e File "/home/biplab/anaconda3/envs/babyai/lib/python3.7/site-packages/gym/envs/registration.py", line 662, in make env = env_creator(_kwargs) File "/home/biplab/Valay/babyai/babyai/levels/iclr19_levels.py", line 116, in init seed=seed File "/home/biplab/Valay/babyai/babyai/levels/levelgen.py", line 32, in init kwargs File "/home/biplab/anaconda3/envs/babyai/lib/python3.7/site-packages/gym_minigrid/roomgrid.py", line 96, in init mission_space='GoToLocal', TypeError: init() missing 1 required positional argument: 'mission_space'
Could you please suggest something to resolve this issue?
Thanks
I have downgrade the minigrid version, and hopefully babyAI will be fixed soon
pip uninstall gym-minigrid
then pip install gym-minigrid==1.0.3
Hi, Thanks for downgrading the version. So these are the instructions to install BabyAI given in the repo:
git clone https://github.com/mila-iqia/babyai.git
cd babyai
conda env create -f environment.yaml
source activate babyai
cd ..
git clone https://github.com/maximecb/gym-minigrid.git
cd gym-minigrid
pip install --editable .
cd ../babyai
pip install --editable .
Since gym-minigrid repo has been updated, I didn't clone it and created a new environment and ran the following code :
git clone https://github.com/mila-iqia/babyai.git
cd babyai
conda env create -f environment.yaml
source activate babyai
pip install gym-minigrid==1.0.3
So now I am able to load the BabyAI environment but when I tried to reset the environment, I got the following error: Python 3.6.13 |Anaconda, Inc.| (default, Jun 4 2021, 14:25:59) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import gym /home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/core.py:26: UserWarning: WARN: Gym minimally supports python 3.6 as the python foundation not longer supports the version, please update your version to 3.7+ "Gym minimally supports python 3.6 as the python foundation not longer supports the version, please update your version to 3.7+" import babyai env = gym.make('BabyAI-GoToRedBall-v0') /home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/utils/seeding.py:64: DeprecationWarning: WARN: Function
rng.randint(low, [high, size, dtype])
is marked as deprecated and will be removed in the future. Please userng.integers(low, [high, size, dtype])
instead. "Functionrng.randint(low, [high, size, dtype])
is marked as deprecated " /home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/core.py:330: DeprecationWarning: WARN: Initializing wrapper in old step API which returns one bool instead of two. It is recommended to setnew_step_api=True
to use new step API. This will be the default behaviour in future. "Initializing wrapper in old step API which returns one bool instead of two. It is recommended to setnew_step_api=True
to use new step API. This will be the default behaviour in future." /home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/wrappers/step_api_compatibility.py:40: DeprecationWarning: WARN: Initializing environment in old step API which returns one bool instead of two. It is recommended to setnew_step_api=True
to use new step API. This will be the default behaviour in future. "Initializing environment in old step API which returns one bool instead of two. It is recommended to setnew_step_api=True
to use new step API. This will be the default behaviour in future." env.reset() Traceback (most recent call last): File "", line 1, in File "/home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/wrappers/order_enforcing.py", line 42, in reset return self.env.reset(kwargs) File "/home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/core.py", line 427, in reset return self.env.reset(kwargs) File "/home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/wrappers/env_checker.py", line 45, in reset return env_reset_passive_checker(self.env, **kwargs) File "/home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/utils/passive_env_checker.py", line 215, in env_reset_passive_checker check_obs(obs, env.observation_space, "reset") File "/home/jupyter/miniconda3/envs/babyai-1/lib/python3.6/site-packages/gym/utils/passive_env_checker.py", line 159, in check_obs ), f"{pre} observation keys is not same as the observation space keys, obs keys: {list(obs.keys())}, space keys: {list(observation_space.spaces.keys())}" AssertionError: The obs returned by the reset()
method observation keys is not same as the observation space keys, obs keys: ['image', 'direction', 'mission'], space keys: ['image']
Is this because gym-minigrid repo has been updated and I didn't install it by cloning the repo or is the issue something else?
Thanks
Hopefully all of these issues will be fixed by BabyAI soon, but in the meantime, you can use env = gym.make('BabyAI-GoToRedBall-v0', disable_env_checker=True)
which should fix your issue
Hi,
That worked. Thanks a lot for the help!
Hi, I am trying to install BabyAI on Linux 64-bit system. I followed the instructions mentioned in the BabyAI repo for installing the environment. The BabyAI environment file specifies Python 3.6 as the dependency while the latest version of gym-minigrid is incompatible with that. So, I modified it to Python 3.7.3 and then ran the following code.
git clone https://github.com/mila-iqia/babyai.git
cd babyai
conda env create -f environment.yaml
source activate babyai
cd ..
git clone https://github.com/maximecb/gym-minigrid.git
cd gym-minigrid
pip install --editable .
cd ../babyai
pip install --editable .
Although, I was able to successfully run this code and install the dependencies, I am getting this error when I am trying to import babyai.
`Python 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.
Can something be done here or can I find the older repo somewhere since the latest version doesn't seem to work with BabyAI?
Thanks