ai2thor
ai2thor copied to clipboard
Minimal example controller initialization hangs
I have a minimal example where the program hangs when initializing the controller. When I run the code described below, nothing is printed and the terminal simply hangs indefinitely.
System details:
- Ubuntu 18.04 on WSL2 on Windows 11
- Python 3.8.11
- Installed using
pip install aithor
Minimal example code:
from ai2thor.controller import Controller
controller = Controller(
agentMode="default",
visibilityDistance=1.5,
scene="FloorPlan212",
# step sizes
gridSize=0.25,
snapToGrid=True,
rotateStepDegrees=90,
# image modalities
renderDepthImage=False,
renderInstanceSegmentation=False,
# camera properties
width=300,
height=300,
fieldOfView=90
)
print("Controller initialized")
event = controller.step(action="RotateRight")
print("Step complete")
metadata = event.metadata
print(event, event.metadata.keys())
Hi @dtch1997, are you running on a headless machine (i.e., a machine without an external monitor) by chance?
Hi @dtch1997, are you running on a headless machine (i.e., a machine without an external monitor) by chance?
Got the same problem. And yes I was trying to run it on a remote Ubuntu server without a monitor.
How to solve it? Thanks!
Could you both run the following:
import ai2thor
import ai2thor.controller
c = ai2thor.controller.Controller(download_only=True)
print(ai2thor.__version__)
print(c._build.url)
print(c._build.platform.name)
print(c._build.platform.validate(None))
and respond with the output?
@xubo92 - Are you running within a container or vm?
@ekolve @mattdeitke
It has been a long time but I re-encounter this problem and I forget how I solved it earlier.
@ekolve I run your code snippet and here is the error info:
File "debug.py", line 3, in <module> c = ai2thor.controller.Controller(download_only=True) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/ai2thor/controller.py", line 485, in __init__ self._build = self.find_build(local_build, commit_id, branch) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/ai2thor/controller.py", line 1155, in find_build if build.platform.is_valid(request): File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/ai2thor/platform.py", line 32, in is_valid return len(cls.validate(request)) == 0 File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/ai2thor/platform.py", line 168, in validate elif cls._select_x_display(request.width, request.height) is None: File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/ai2thor/platform.py", line 71, in _select_x_display valid_displays = cls._valid_x_displays(width, height) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/ai2thor/platform.py", line 147, in _valid_x_displays disp = Xlib.display.Display(":%s" % display_str) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/Xlib/display.py", line 89, in __init__ self.display = _BaseDisplay(display) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/Xlib/display.py", line 71, in __init__ protocol_display.Display.__init__(self, *args, **keys) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/Xlib/protocol/display.py", line 162, in __init__ auth_prot_data = auth_data) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/Xlib/protocol/display.py", line 1075, in __init__ display.send_and_recv(request = -1) File "/home/xubo/anaconda3/envs/ai2thor/lib/python3.7/site-packages/Xlib/protocol/display.py", line 561, in send_and_recv rs, ws, es = select.select([self.socket], writeset, [], timeout)
Since I run my code on a Ubuntu server without physical monitor, I also try to use startx()
. But the error is same as above.
I am also having a hanging issue. However, it only happens after initializing 20ish controllers. I am also running my code on a Ubuntu server without a physical monitor and running an Xserver with X
, but it does not help with my issue.