facebookresearch / mtenv

MultiTask Environments for Reinforcement Learning.
MIT License
74 stars 5 forks source link

metaclass conflict #14

Open victorgabillon opened 2 years ago

victorgabillon commented 2 years ago

Hello

Right after installation of the mtenv, when importing into python (for instance running 'from mtenv import make'), the following error appears:

Traceback (most recent call last): File "", line 1, in File "/home/victor/Downloads/mtenv-1.0.0/mtenv/init.py", line 4, in from mtenv.core import MTEnv # noqa: F401 File "/home/victor/Downloads/mtenv-1.0.0/mtenv/core.py", line 21, in class MTEnv(Env, ABC): # type: ignore[misc] TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

using python 3.9

the error was obtained following the following steps:

pip install git+https://github.com/facebookresearch/mtenv.git@main#egg=mtenv pip install git+https://github.com/facebookresearch/mtenv.git@main#egg="mtenv[metaworld]" python3.9

from mtenv import make

Do you have an idea of what is happening? Thanks for your help?

shagunsodhani commented 2 years ago

Thanks for filing the issue. I plan to upgrade the library to work will new version of gym. Hopefully that will fix this issue as well.

shagunsodhani commented 2 years ago

Hey @victorgabillon The issue is fixed on https://github.com/facebookresearch/mtenv/tree/v2.0.0. Could you please try with that branch?

vaisakh-shaj commented 2 years ago

I tried to pip install from the branch you specified using following command:

pip install git+https://github.com/facebookresearch/mtenv.git@v2.0.0

Unfortunately the issue still persists... I am using python version 3.8.3

vaisakh-shaj commented 2 years ago

I also get the same error when mtenv is installed from https://github.com/facebookresearch/mtrl ... Thanks in advance for your help and responses :)

shagunsodhani commented 2 years ago

@vaisakh-shaj what environment are you trying?

vaisakh-shaj commented 2 years ago

@shagunsodhani I wanted to try the multi-task environments in the HiP Block MDP paper, if that is what you mean... But I get the error right from the start, whenever I try to import mtenv in my python script

victorgabillon commented 2 years ago

Thank you Shagun!

Now I can install and import mtenv without issues using the branch v2.0.0. However I still struggle to use it properly: as executing

from mtenv import make env = make("MT-MetaWorld-MT10-v0")

runs into the following meta class error: File "/home/victor/testtt/mtenv/tototyy/lib/python3.9/site-packages/metaworld/envs/mujoco/mujoco_env.py", line 30, in class MujocoEnv(gym.Env, abc.ABC): TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Note that this time the problem is in the 'metaworld' repository

Also trying : from mtenv import make env = make("CartPole-v1")

runs into the error Traceback (most recent call last): File "", line 1, in File "/home/victor/test55/mtenv/mtenv/envs/registration.py", line 146, in make assert isinstance(spec_, MultitaskEnvSpec)

Do you have any suggestions on how to solve these issues? Hope this helps!

YouJiacheng commented 2 years ago

For @vaisakh-shaj and @victorgabillon There is an additional remark for @shagunsodhani 's comment "The issue is fixed on https://github.com/facebookresearch/mtenv/tree/v2.0.0" The issue is fixed in v2.0.0 actually by pining gym version at 0.21.0. (Remove ABC from MTEnv bases can not ensure that metaworld works). Because the metaclass conflict will only happen if gym version 0.25.0 and 0.25.1. See https://github.com/openai/gym/pull/3001