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

Minimal example controller initialization hangs #903

Open
dtch1997 opened this issue Oct 3, 2021 · 6 comments
Open

Minimal example controller initialization hangs #903

dtch1997 opened this issue Oct 3, 2021 · 6 comments

Comments

@dtch1997
Copy link

dtch1997 commented Oct 3, 2021

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())
@mattdeitke
Copy link
Collaborator

Hi @dtch1997, are you running on a headless machine (i.e., a machine without an external monitor) by chance?

@xubo92
Copy link

xubo92 commented Oct 4, 2021

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!

@ekolve
Copy link

ekolve commented Oct 4, 2021

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?

@xubo92
Copy link

xubo92 commented Feb 23, 2022

@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.

@qazwini
Copy link

qazwini commented Mar 14, 2022

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.

@SH9959
Copy link

SH9959 commented Oct 6, 2024

What if the output was like:

>>> print(ai2thor.__version__)
5.0.0
>>> print(c._build.url)
http://s3-us-west-2.amazonaws.com/ai2-thor-public/builds/thor-Linux64-f0825767cd50d69f666c7f282e54abfe58f1e917.zip
>>> print(c._build.platform.name)
<bound method BasePlatform.name of <class 'ai2thor.platform.Linux64'>>
>>> print(c._build.platform.validate(None))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hsong/miniconda3/envs/ai2thor500/lib/python3.8/site-packages/ai2thor/platform.py", line 162, in validate
    if request.headless:
AttributeError: 'NoneType' object has no attribute 'headless'

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

6 participants