ucsdarclab/dVRL

Issue while starting the enviorment

Closed this issue · 1 comments

When running the preview code included in the repo. A error pops up.

HTTPError Traceback (most recent call last)
~/miniconda3/lib/python3.7/site-packages/docker/api/client.py in _raise_for_status(self, response)
260 try:
--> 261 response.raise_for_status()
262 except requests.exceptions.HTTPError as e:

~/miniconda3/lib/python3.7/site-packages/requests/models.py in raise_for_status(self)
938 if http_error_msg:
--> 939 raise HTTPError(http_error_msg, response=self)
940

HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.35/containers/create

During handling of the above exception, another exception occurred:

APIError Traceback (most recent call last)
in
----> 1 env_reach = gym.make("dVRLReach-v0")

~/miniconda3/lib/python3.7/site-packages/gym/envs/registration.py in make(id, **kwargs)
181
182 def make(id, **kwargs):
--> 183 return registry.make(id, **kwargs)
184
185 def spec(id):

~/miniconda3/lib/python3.7/site-packages/gym/envs/registration.py in make(self, path, **kwargs)
123 logger.info('Making new env: %s', path)
124 spec = self.spec(path)
--> 125 env = spec.make(**kwargs)
126 # We used to have people override _reset/_step rather than
127 # reset/step. Set _gym_disable_underscore_compat = True on

~/miniconda3/lib/python3.7/site-packages/gym/envs/registration.py in make(self, kwargs)
87 else:
88 cls = load(self._entry_point)
---> 89 env = cls(
_kwargs)
90
91 # Make the enviroment aware of which spec it came from.

~/Desktop/dVRL/dVRL_simulator/environments/reach.py in init(self, psm_num, reward_type)
13 dynamics_enabled = False, two_dimension_only = False,
14 randomize_initial_pos_obj = False, randomize_initial_pos_ee = False,
---> 15 docker_container = "vrep_ee_reach")
16
17 utils.EzPickle.init(self)

~/Desktop/dVRL/dVRL_simulator/PsmEnv_Position.py in init(self, psm_num, n_substeps, block_gripper, has_object, target_in_the_air, height_offset, target_offset, obj_range, target_range, distance_threshold, initial_pos, reward_type, dynamics_enabled, two_dimension_only, randomize_initial_pos_obj, randomize_initial_pos_ee, docker_container)
76 super(PSMEnv_Position, self).init(psm_num = psm_num, n_substeps=n_substeps, n_states = self.n_states,
77 n_goals = 3, n_actions=self.n_actions, camera_enabled = False,
---> 78 docker_container =docker_container)
79
80

~/Desktop/dVRL/dVRL_simulator/PsmEnv.py in init(self, psm_num, n_actions, n_states, n_goals, n_substeps, camera_enabled, docker_container)
63 }
64
---> 65 self.container = client.containers.run(docker_container, detach = True, **kwargs)
66 proc = subprocess.Popen(['docker','inspect','-f', "'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'", self.container.id],
67 stdout=subprocess.PIPE,

~/miniconda3/lib/python3.7/site-packages/docker/models/containers.py in run(self, image, command, stdout, stderr, remove, **kwargs)
783 try:
784 container = self.create(image=image, command=command,
--> 785 detach=detach, **kwargs)
786 except ImageNotFound:
787 self.client.images.pull(image, platform=platform)

~/miniconda3/lib/python3.7/site-packages/docker/models/containers.py in create(self, image, command, **kwargs)
841 kwargs['version'] = self.client.api._version
842 create_kwargs = _create_container_args(kwargs)
--> 843 resp = self.client.api.create_container(**create_kwargs)
844 return self.get(resp['Id'])
845

~/miniconda3/lib/python3.7/site-packages/docker/api/container.py in create_container(self, image, command, hostname, user, detach, stdin_open, tty, ports, environment, volumes, network_disabled, name, entrypoint, working_dir, domainname, host_config, mac_address, labels, stop_signal, networking_config, healthcheck, stop_timeout, runtime, use_config_proxy)
425 stop_timeout, runtime
426 )
--> 427 return self.create_container_from_config(config, name)
428
429 def create_container_config(self, *args, **kwargs):

~/miniconda3/lib/python3.7/site-packages/docker/api/container.py in create_container_from_config(self, config, name)
436 }
437 res = self._post_json(u, data=config, params=params)
--> 438 return self._result(res, True)
439
440 def create_host_config(self, *args, **kwargs):

~/miniconda3/lib/python3.7/site-packages/docker/api/client.py in _result(self, response, json, binary)
265 def _result(self, response, json=False, binary=False):
266 assert not (json and binary)
--> 267 self._raise_for_status(response)
268
269 if json:

~/miniconda3/lib/python3.7/site-packages/docker/api/client.py in _raise_for_status(self, response)
261 response.raise_for_status()
262 except requests.exceptions.HTTPError as e:
--> 263 raise create_api_error_from_http_exception(e)
264
265 def _result(self, response, json=False, binary=False):

~/miniconda3/lib/python3.7/site-packages/docker/errors.py in create_api_error_from_http_exception(e)
29 else:
30 cls = NotFound
---> 31 raise cls(e, response=response, explanation=explanation)
32
33

APIError: 400 Client Error: Bad Request ("Unknown runtime specified nvidia")

After a little digging I think I can guess your problem (and it is because I did not give proper instructions for installing nvidia-docker in the readme). Please install nvidia-docker and test to make sure you can use the nvidia runtime:
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi

Then you should be able to run my docker:
docker run --env="DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --runtime=nvidia vrep_ee_reach

If this all works, this should resolve your issue. Thanks for letting me know!