ericchen321 / ros_x_habitat

A bridge betwwen the ROS ecosystem and AI Habitat.
93 stars 18 forks source link

TypeError: metaclass conflict #33

Open lineojcd opened 11 months ago

lineojcd commented 11 months ago

hi, followed the instruction tightly, I have successfully installed habitat-sim(v0.2.0), habitat-lab(v0.2.0) and rosxhabitat. python3.6, gym version is 0.26.2

habitat-sim(v0.2.0) is installed from conda

Then I ran this command, and got the error below: (rosxhab) arcs@ARCS:~/catkin_ws/src/ros_x_habitat$ python src/scripts/eval_and_vis_habitat.py --input-type rgbd --model-path data/checkpoints/v2/gibson-rgbd-best.pth --task-config configs/setting_2_configs/pointnav_rgb-mp3d.yaml --episode-id -1 --seed-file-path seeds/2_seeds.csv --log-dir log-dir --make-maps --map-dir map-dir --make-plots --plot-dir plot-dir

/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/gym/core.py:27: 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+" Traceback (most recent call last): File "src/scripts/eval_and_vis_habitat.py", line 5, in from src.evaluators.habitat_evaluator import HabitatEvaluator File "/home/arcs/catkin_ws/src/ros_x_habitat/src/evaluators/habitat_evaluator.py", line 9, in from habitat_baselines.agents.ppo_agents import PPOAgent File "/home/arcs/C++project/habitat-lab/habitat_baselines/init.py", line 7, in from habitat_baselines.common.base_il_trainer import BaseILTrainer File "/home/arcs/C++project/habitat-lab/habitat_baselines/common/base_il_trainer.py", line 10, in from habitat_baselines.common.base_trainer import BaseTrainer File "/home/arcs/C++project/habitat-lab/habitat_baselines/common/base_trainer.py", line 18, in from habitat_baselines.common.tensorboard_utils import TensorboardWriter File "/home/arcs/C++project/habitat-lab/habitat_baselines/common/tensorboard_utils.py", line 11, in from torch.utils.tensorboard import SummaryWriter File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/torch-1.10.2-py3.6-linux-x86_64.egg/torch/utils/tensorboard/init.py", line 13, in from .writer import FileWriter, SummaryWriter # noqa: F401 File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/torch-1.10.2-py3.6-linux-x86_64.egg/torch/utils/tensorboard/writer.py", line 13, in from tensorboard.summary.writer.event_file_writer import EventFileWriter File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/summary/init.py", line 22, in from tensorboard.summary import v1 # noqa: F401 File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/summary/v1.py", line 23, in from tensorboard.plugins.histogram import summary as _histogram_summary File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/plugins/histogram/summary.py", line 35, in from tensorboard.plugins.histogram import summary_v2 File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/plugins/histogram/summary_v2.py", line 35, in from tensorboard.util import tensor_util File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/util/tensor_util.py", line 20, in from tensorboard.compat.tensorflow_stub import dtypes, compat, tensor_shape File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/compat/tensorflow_stub/init.py", line 25, in from . import app # noqa File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/compat/tensorflow_stub/app.py", line 21, in from . import flags File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/tb_nightly-2.15.0a20231013-py3.6.egg/tensorboard/compat/tensorflow_stub/flags.py", line 25, in from absl.flags import * # pylint: disable=wildcard-import File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/absl_py-2.0.0-py3.6.egg/absl/flags/init.py", line 35, in from absl.flags import _argument_parser File "/home/arcs/anaconda3/envs/rosxhab/lib/python3.6/site-packages/absl_py-2.0.0-py3.6.egg/absl/flags/_argument_parser.py", line 82, in class ArgumentParser(Generic[_T], metaclass=_ArgumentParserCache): TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases (rosxhab) arcs@ARCS:~/catkin_ws/src/ros_x_habitat$

Can you help me out?

PhilipAmadasun commented 9 months ago

@lineojcd I'm also having the same problem, have you been to find a solution?

ericchen321 commented 9 months ago

Hello @PhilipAmadasun, thanks for reaching out! I suspect the error was caused by package versioning, since Habitat's requirements.txt's generally specify min version's but not max verion's, and I guess as time passes by old API calls no longer work.

I've updated requirements.txt and Step 1-5 of the instruction. Could you reinstall those packages + Habitat Lab + Sim and see if things work? Also note that I don't have the machine with a working conda env next to me so I'm not entirely sure if those dependencies would work out. But if you still get the same error I would suggest tweaking the version of tb-nightly because I guess that's the package that breaks.

@lineojcd It's been a while since you asked but in case if you're still working on this feel free to give it a shot. Sorry about the late reply.

PhilipAmadasun commented 8 months ago

@ericchen321 @lineojcd I got mine to work by downgrading my absl_py library to I think 0.80 or something like that. And I uninstalled pytorch and installed a version of pytorch that was compiled to run in CUDA11.3 run time, although I suspect other versions of CUDA would work too: pip install torch --extra-index-url https://download.pytorch.org/whl/cu113

ericchen321 commented 8 months ago

Thanks for suggesting this. I've updated instructions to suggest users install CUDA-compiled torch if they have an NVIDIA card.