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

"check_thor.py" incurs the FileExistsError from os.mkfifo. #91

Closed
maguro27 opened this issue Jun 29, 2021 · 5 comments
Closed

"check_thor.py" incurs the FileExistsError from os.mkfifo. #91

maguro27 opened this issue Jun 29, 2021 · 5 comments

Comments

@maguro27
Copy link

maguro27 commented Jun 29, 2021

I met the FileExistsError from os.mkfifo when I ran the check_thor.py after running the docker container based on a slightly modified Dockerfile.
The main modification of the Dockerfile is that I change the docker image from nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04 to nvcr.io/nvidia/cudagl:11.1.1-devel-ubuntu18.04 because my GPU machine does not match the NVIDIA driver version (namely, use cuda 11.1 because of using NVIDIA RTX A6000)
Moreover, I upgrade the ai2thor from ver. 2.1.0 to ver. 3.3.2 because of #90.
The full error message is as follows,

(alfred_env) maguro@s184:~/alfred$ python check_thor.py 
/home/maguro/alfred_env/lib/python3.6/site-packages/ai2thor/controller.py:1198: UserWarning: start method depreciated. The server started when the Controller was initialized.
  "start method depreciated. The server started when the Controller was initialized."
Traceback (most recent call last):
  File "check_thor.py", line 4, in <module>
    c.start()
  File "/home/maguro/alfred_env/lib/python3.6/site-packages/ai2thor/controller.py", line 1209, in start
    self.server.start()
  File "/home/maguro/alfred_env/lib/python3.6/site-packages/ai2thor/fifo_server.py", line 202, in start
    os.mkfifo(self.server_pipe_path)
FileExistsError: [Errno 17] File exists

However, I did not meet any error when I ran the ai2thor minimal example and the exmaple_agent.py of the ai2thor-docker.

the ai2thor minimal example

(alfred_env) maguro@s184:~/projects/ai2thor-docker$ python
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ai2thor.controller import Controller
>>> controller = Controller(scene="FloorPlan10")

>>> event = controller.step(action="RotateRight")
>>> metadata = event.metadata
>>> print(event, event.metadata.keys())
<ai2thor.server.Event at 0x7fca1f41f208
    .metadata["lastAction"] = RotateRight
    .metadata["lastActionSuccess"] = True
    .metadata["errorMessage"] = "
    .metadata["actionReturn"] = None
> dict_keys(['objects', 'isSceneAtRest', 'agent', 'hand', 'arm', 'fov', 'cameraPosition', 'cameraOrthSize', 'thirdPartyCameras', 'collided', 'collidedObjects', 'inventoryObjects', 'sceneName', 'lastAction', 'errorMessage', 'errorCode', 'lastActionSuccess', 'screenWidth', 'screenHeight', 'agentId', 'colors', 'colorBounds', 'flatSurfacesOnGrid', 'distances', 'normals', 'isOpenableGrid', 'segmentedObjectIds', 'objectIdsInBox', 'actionIntReturn', 'actionFloatReturn', 'actionStringsReturn', 'actionFloatsReturn', 'actionVector3sReturn', 'visibleRange', 'currentTime', 'sceneBounds', 'updateCount', 'fixedUpdateCount', 'actionReturn'])

the exmaple_agent.py of the ai2thor-docker

(alfred_env) maguro@s184:~/projects/ai2thor-docker$ python example_agent.py 
Skipping Xorg server - DISPLAY is already running at :1
{'cameraHorizon': 0.0,
 'inHighFrictionArea': False,
 'isStanding': True,
 'name': 'agent',
 'position': {'x': -1.5, 'y': 0.9009982347488403, 'z': -1.5},
 'rotation': {'x': -0.0, 'y': 270.0, 'z': 0.0}}

Additionally, I tried changing tempfile function in the fifo_server.py of the ai2thor
The changed lines as follows,

54 - self.tmp_dir = tempfile.TemporaryDirectory()
55 - self.server_pipe_path = os.path.join(self.tmp_dir.name, "server.pipe")
56 - self.client_pipe_path = os.path.join(self.tmp_dir.name, "client.pipe")

54 + self.tmp_dir = tempfile.mkdtemp()
55 + self.server_pipe_path = os.path.join(self.tmp_dir, "server.pipe")
56 + self.client_pipe_path = os.path.join(self.tmp_dir, "client.pipe")

However, I couldn't fix the FileExistError.
Next, I tried to changing the start function in the fifo_server.py of the ai2thor

201 -     def start(self):
202 -        os.mkfifo(self.server_pipe_path)
203 -        os.mkfifo(self.client_pipe_path)
204 -        self.started = True

201 +    def start(self):
202 +        if os.path.exists(self.server_pipe_path) or os.path.exists(self.client_pipe_path):
203 +            self.tmp_dir = tempfile.TemporaryDirectory()
204 +            self.server_pipe_path = os.path.join(self.tmp_dir.name, "server.pipe")
205 +            self.client_pipe_path = os.path.join(self.tmp_dir.name, "client.pipe")
206 +        os.mkfifo(self.server_pipe_path)
207 +        os.mkfifo(self.client_pipe_path)
208 +        self.started = True

However, I met another error.

(alfred_env) maguro@s184:~/alfred$ python check_thor.py 
/home/maguro/alfred_env/lib/python3.6/site-packages/ai2thor/controller.py:1198: UserWarning: start method depreciated. The server started when the Controller was initialized.
  "start method depreciated. The server started when the Controller was initialized."
Traceback (most recent call last):
  File "check_thor.py", line 4, in <module>
    c.start()
  File "/home/maguro/alfred_env/lib/python3.6/site-packages/ai2thor/controller.py", line 1220, in start
    self.last_event = self.server.receive()
  File "/home/maguro/alfred_env/lib/python3.6/site-packages/ai2thor/fifo_server.py", line 179, in receive
    metadata, files = self._recv_message()
  File "/home/maguro/alfred_env/lib/python3.6/site-packages/ai2thor/fifo_server.py", line 108, in _recv_message
    header = self.server_pipe.read(self.header_size)  # message type + length
ValueError: read of closed file

How do I fix the FileExistsError?
Please lend me your hand.

@maguro27 maguro27 changed the title "chech_thor.py" incurs the FileExistsError from os.mkfifo. "check_thor.py" incurs the FileExistsError from os.mkfifo. Jun 29, 2021
@MohitShridhar
Copy link
Collaborator

@maguro27, I am not sure what is happening here. Can you post it on ai2thor issues?
https://github.com/allenai/ai2thor/issues

@maguro27
Copy link
Author

@MohitShridhar Thank you for the recommendation.
I'll post the solution if I resolve this issue.

@maguro27
Copy link
Author

It's an easy solution.
Line 4 of check_thor.py doesn't need.
The solution is as follows,

4 - c.start()

@MohitShridhar
Copy link
Collaborator

MohitShridhar commented Jun 30, 2021

@maguro27 note that ALFRED might not be compatible with the latest versions of AI2THOR. See this thread: #45

However, you can still use the latest version for pre-training and then finetune on ai2thor==2.1.0 with ALFRED data.

@maguro27
Copy link
Author

maguro27 commented Jul 1, 2021

@MohitShridhar Thank you for the notification!
Hmm...
I cannot fix the ConnectionResetError of #90 when I use ai2thor==2.1.0.
I post the above issue to issue of the ai2thor repository.
If I fix the ConnectionResetError, I add a solution to #90.

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

2 participants