facebookresearch / mtrl

Multi Task RL Baselines
MIT License
223 stars 28 forks source link

materials.xml is missing #3

Closed jiaweihhuang closed 3 years ago

jiaweihhuang commented 3 years ago

Description

Hi, I meet with some missing file problem when I try to run exps with mtrl.

After installation according to the instructions, when I try to run deepMDP or HiP-BMDP algorithms, there is an error about the following XML file is missing:

/home/myname/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/./common/materials.xml

I wonder if I miss some packages which should be installed before running experiments?

How to reproduce

create a new python env with anaconda:

conda create -n test python==3.8

run the following commands to install mtrl/mtenv:

git clone https://github.com/facebookresearch/mtrl.git
cd mtrl
pip install -r requirements/dev.txt
pip install mtenv
pip install git+https://github.com/facebookresearch/mtenv.git@main#egg="mtenv[metaworld]"
pip install git+https://github.com/facebookresearch/mtenv.git@main#egg="mtenv[hipbmdp]"
pip install dm_control
pip install --upgrade numpy

and use the following to start the experiments (according to https://mtrl.readthedocs.io/en/latest/pages/tutorials/baseline.html):

MUJOCO_GL="osmesa" LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/nvidia-opengl/:$LD_LIBRARY_PATH PYTHONPATH=. python3 -u main.py \
setup=hipbmdp \
env=dmcontrol-finger-spin-distribution-v0 \
agent=hipbmdp \
setup.seed=1 \
replay_buffer.batch_size=256

Error Messages:

torch version = 1.7.1+cu110
/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
  warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow'))
[2021-04-08 03:35:38,823][absl][INFO] - MUJOCO_GL=osmesa, attempting to import specified OpenGL backend.
[2021-04-08 03:35:38,830][OpenGL.acceleratesupport][INFO] - No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
[2021-04-08 03:35:39,000][absl][INFO] - MuJoCo library version is: 200
Traceback (most recent call last):
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/utils.py", line 66, in call
    return _call_callable(type_or_callable, config, *args, **kwargs)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/_internal/utils.py", line 510, in _call_callable
    return fn(*args, **final_kwargs)
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/env/builder.py", line 46, in build_dmcontrol_vec_env
    env = VecEnv(env_metadata=env_metadata, env_fns=funcs_to_make_envs, context="spawn")
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/env/vec_env.py", line 22, in __init__
    super().__init__(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/vector/async_vector_env.py", line 77, in __init__
    dummy_env = env_fns[0]()
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/env/builder.py", line 32, in _func
    return mtenv.make(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/mtenv/envs/registration.py", line 78, in make
    env = mtenv_registry.make(id, **kwargs)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/envs/registration.py", line 90, in make
    env = spec.make(**kwargs)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/envs/registration.py", line 60, in make
    env = cls(**_kwargs)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/mtenv/envs/hipbmdp/env.py", line 78, in build
    mtenv = MultiEnvWrapper(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/mtenv/envs/shared/wrappers/multienv.py", line 44, in __init__
    self._envs[initial_task_state] = funcs_to_make_envs[initial_task_state]()
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/mtenv/envs/hipbmdp/env.py", line 58, in _func
    return dmc_env.build_dmc_env(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/mtenv/envs/hipbmdp/dmc_env.py", line 96, in build_dmc_env
    env = _build_env(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/mtenv/envs/hipbmdp/dmc_env.py", line 56, in _build_env
    return gym.make(env_id)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/envs/registration.py", line 145, in make
    return registry.make(id, **kwargs)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/envs/registration.py", line 90, in make
    env = spec.make(**kwargs)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/envs/registration.py", line 59, in make
    cls = load(self.entry_point)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/gym/envs/registration.py", line 18, in load
    mod = importlib.import_module(mod_name)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/mtenv/envs/hipbmdp/wrappers/dmc_wrapper.py", line 10, in <module>
    import local_dm_control_suite as local_dmc_suite
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/__init__.py", line 27, in <module>
    from . import (
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/acrobot.py", line 27, in <module>
    from . import common
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/common/__init__.py", line 33, in <module>
    ASSETS = {
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/common/__init__.py", line 34, in <dictcomp>
    filename: resources.GetResource(os.path.join(_SUITE_DIR, filename))
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/dm_control/utils/io.py", line 22, in GetResource
    with open(name, mode=mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/./common/materials.xml'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/utils.py", line 63, in call
    return _instantiate_class(type_or_callable, config, *args, **kwargs)
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/_internal/utils.py", line 500, in _instantiate_class
    return clazz(*args, **final_kwargs)
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/experiment/dmcontrol.py", line 23, in __init__
    super().__init__(config, experiment_id)
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/experiment/multitask.py", line 25, in __init__
    super().__init__(config, experiment_id)
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/experiment/experiment.py", line 33, in __init__
    self.envs, self.env_metadata = self.build_envs()
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/experiment/multitask.py", line 43, in build_envs
    envs[mode] = hydra.utils.instantiate(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/utils.py", line 70, in call
    raise HydraException(f"Error calling '{cls}' : {e}") from e
hydra.errors.HydraException: Error calling 'mtrl.env.builder.build_dmcontrol_vec_env' : [Errno 2] No such file or directory: '/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/./common/materials.xml'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/_internal/utils.py", line 198, in run_and_report
    return func()
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/_internal/utils.py", line 347, in <lambda>
    lambda: hydra.run(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 107, in run
    return run_job(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/core/utils.py", line 128, in run_job
    ret.return_value = task_function(task_cfg)
  File "main.py", line 15, in launch
    return run(config)
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/app/run.py", line 35, in run
    experiment_utils.prepare_and_run(config=config)
  File "/home/v-jiahuang/test_mtrl/mtrl/mtrl/experiment/utils.py", line 23, in prepare_and_run
    experiment = hydra.utils.instantiate(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/utils.py", line 70, in call
    raise HydraException(f"Error calling '{cls}' : {e}") from e
hydra.errors.HydraException: Error calling 'mtrl.experiment.dmcontrol.Experiment' : Error calling 'mtrl.env.builder.build_dmcontrol_vec_env' : [Errno 2] No such file or directory: '/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite/./common/materials.xml'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 19, in <module>
    launch()
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/main.py", line 32, in decorated_main
    _run_hydra(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/_internal/utils.py", line 346, in _run_hydra
    run_and_report(
  File "/home/v-jiahuang/anaconda3/envs/test/lib/python3.8/site-packages/hydra/_internal/utils.py", line 237, in run_and_report
    assert mdl is not None
AssertionError

System information

Any other information

Btw, when I install mtrl, there is another error/warning:

 FileNotFoundError: [Errno 2] No such file or directory: 'requirements/main.txt'

and indeed I can not find main.txt in requirements, but the installation is not interrupted so I guess maybe it's not an important problem.

jiaweihhuang commented 3 years ago

Hi, I just noticed that there is a folder named local_dm_control_suite on the mtenv project (https://github.com/facebookresearch/mtenv), which contains those xml files. After replacing /home/myname/anaconda3/envs/test/lib/python3.8/site-packages/local_dm_control_suite with that folder, I can run these experiments. So please close this issue if necessary.

But I'm still curious about: did I miss something when I install mtenv, so that the local_dm_control_suite folder in github page was not copied to the ..../site-packages directory directly?

shagunsodhani commented 3 years ago

Thanks for reporting the issue (with detailed diagnostics). I am closing this issue but opening another issue in mtenv, where I think this issue should belong. Lets continue the discussion there.