Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile does not support mujoco rendering #20

Open
vib2810 opened this issue Apr 21, 2022 · 1 comment
Open

Dockerfile does not support mujoco rendering #20

vib2810 opened this issue Apr 21, 2022 · 1 comment

Comments

@vib2810
Copy link

vib2810 commented Apr 21, 2022

The docker image that is provided (kchua/handful-of-trials) can run the mbexp.py script, but cannot run the render.py script. The error is as follows:

-> python scripts/render.py -env cartpole -logdir log/ -model-dir log/2021-11-06--06\:49\:30/
2022-04-21 09:37:34.268473: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2022-04-21 09:37:34.346063: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:897] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2022-04-21 09:37:34.346510: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1392] Found device 0 with properties: 
name: NVIDIA GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493
pciBusID: 0000:01:00.0
totalMemory: 3.95GiB freeMemory: 3.63GiB
2022-04-21 09:37:34.346552: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1471] Adding visible gpu devices: 0
2022-04-21 09:37:34.538159: I tensorflow/core/common_runtime/gpu/gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-04-21 09:37:34.538212: I tensorflow/core/common_runtime/gpu/gpu_device.cc:958]      0 
2022-04-21 09:37:34.538222: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   N 
2022-04-21 09:37:34.538359: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3359 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1)
{'ctrl_cfg': {'env': <dmbrl.env.cartpole.CartpoleEnv object at 0x7fb8eb83fd68>,
              'opt_cfg': {'ac_cost_fn': <function CartpoleConfigModule.ac_cost_fn at 0x7fb8eb8438c8>,
                          'cfg': {'alpha': 0.1,
                                  'max_iters': 5,
                                  'num_elites': 40,
                                  'popsize': 400},
                          'mode': 'CEM',
                          'obs_cost_fn': <function CartpoleConfigModule.obs_cost_fn at 0x7fb8eb843840>,
                          'plan_hor': 25},
              'prop_cfg': {'mode': 'TSinf',
                           'model_init_cfg': {'load_model': True,
                                              'model_class': <class 'dmbrl.modeling.models.BNN.BNN'>,
                                              'model_constructor': <bound method CartpoleConfigModule.nn_constructor of <cartpole.CartpoleConfigModule object at 0x7fb8eb83f9e8>>,
                                              'model_dir': 'log/2021-11-06--06:49:30/',
                                              'num_nets': 5},
                           'model_pretrained': True,
                           'model_train_cfg': {'epochs': 5},
                           'npart': 20,
                           'obs_postproc': <function CartpoleConfigModule.obs_postproc at 0x7fb8eb843730>,
                           'obs_preproc': <function CartpoleConfigModule.obs_preproc at 0x7fb8eb8436a8>,
                           'targ_proc': <function CartpoleConfigModule.targ_proc at 0x7fb8eb8437b8>}},
 'exp_cfg': {'exp_cfg': {'ninit_rollouts': 0,
                         'nrollouts_per_iter': 1,
                         'ntrain_iters': 1},
             'log_cfg': {'logdir': 'log/', 'nrecord': 1},
             'sim_cfg': {'env': <dmbrl.env.cartpole.CartpoleEnv object at 0x7fb8eb83fd68>,
                         'task_hor': 200}}}
Model loaded from log/2021-11-06--06:49:30/.
Created an ensemble of 5 neural networks with variance predictions.
Created an MPC controller, prop mode TSinf, 20 particles. 
Trajectory prediction logging is disabled.
####################################################################
Starting training iteration 1.
ERROR:mujoco_py.mjviewer:GLFW error: 65543, desc: b'GLX: Failed to create context: BadValue (integer parameter out of range for operation)'
ERROR:mujoco_py.mjviewer:GLFW error: 65537, desc: b'The GLFW library is not initialized'
ERROR:mujoco_py.mjviewer:GLFW error: 65537, desc: b'The GLFW library is not initialized'
ERROR:mujoco_py.mjviewer:GLFW error: 65537, desc: b'The GLFW library is not initialized'
ERROR:mujoco_py.mjviewer:GLFW error: 65537, desc: b'The GLFW library is not initialized'
Average action selection time:  1.2227837240695953
Rollout length:  200
Rewards obtained: [179.53440146325102]
ERROR:mujoco_py.mjviewer:GLFW error: 65537, desc: b'The GLFW library is not initialized'
ERROR:mujoco_py.mjviewer:GLFW error: 65537, desc: b'The GLFW library is not initialized'
Exception ignored in: <bound method Env.__del__ of <dmbrl.env.cartpole.CartpoleEnv object at 0x7fb8eb83fd68>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 203, in __del__
    self.close()
  File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 164, in close
    self.render(close=True)
  File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 150, in render
    return self._render(mode=mode, close=close)
  File "/usr/local/lib/python3.5/dist-packages/gym/envs/mujoco/mujoco_env.py", line 105, in _render
    self._get_viewer().finish()
  File "/usr/local/lib/python3.5/dist-packages/mujoco_py/mjviewer.py", line 325, in finish
    glfw.destroy_window(self.window)
  File "/usr/local/lib/python3.5/dist-packages/mujoco_py/glfw.py", line 809, in destroy_window
    window_addr = ctypes.cast(ctypes.pointer(window),
TypeError: _type_ must have storage info
@vib2810
Copy link
Author

vib2810 commented Apr 21, 2022

Also, the docker file in the repository will not work, as different versions of packages will be installed by pip. I have added versions to each package in the docker file as follows:

FROM nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

# Install pip
RUN apt-get update
RUN apt-get -y install python3 python3-pip python3-dev python3-tk
RUN apt-get -y install libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev

# Install basic libraries
RUN pip3 install --upgrade pip==10.0.1
RUN pip3 install grpcio==1.13.0 numpy==1.14.5 matplotlib==2.2.2 scipy==1.1.0 scikit-learn==0.19.2 future==0.16.0
RUN pip3 install tensorflow-gpu==1.9

# Install MuJoCo + OpenAI gym
RUN pip3 install gym==0.9.4
RUN apt-get update
RUN apt-get -y install unzip unetbootin wget
RUN mkdir -p /.mujoco && cd /.mujoco && wget https://www.roboti.us/download/mjpro131_linux.zip && unzip mjpro131_linux.zip
ENV MUJOCO_PY_MJKEY_PATH="/root/.mujoco/mjkey.txt"
ENV MUJOCO_PY_MJPRO_PATH="/root/.mujoco/mjpro131"
RUN pip3 install mujoco-py==0.5.7

# Install additional requirements
RUN pip3 install datetime==4.2 gitpython==2.1.11 h5py==2.8.0 tqdm==4.24.0 dotmap===1.2.20 cython==0.28.5

# GPFlow (Install using pip3)
RUN pip3 install gpflow==1.2.0
RUN apt-get -y install git
# RUN git clone https://github.com/GPflow/GPflow.git
RUN pip3 install pandas multipledispatch==0.6.0 pytest==3.7.1
# RUN cd GPflow/ && pip install . --no-deps

# Create copy of Deep MBRL repo and place in ~/handful-of-trials
RUN cd ~ && git clone https://github.com/kchua/handful-of-trials.git

#Some extra files to resolve errors with render.py
RUN apt-get install libxrandr2:amd64 libxinerama1:amd64 libxcursor1:amd64
RUN apt-get install -y libglfw3-dev libepoxy-dev libjsoncpp-dev libgtk-3-dev libx11-dev
RUN apt-get -y install eog ffmpeg
RUN apt-get install -y mesa-utils libgl1-mesa-glx
ENV LIBGL_ALWAYS_INDIRECT=1

# Environment setup
RUN echo 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu' >> /root/.bashrc
RUN echo 'alias python=python3' >> /root/.bashrc

CMD /bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant