Lux-AI-Challenge / Lux-Design-S1

Home to the design and engine of the @Lux-AI-Challenge Season 1, hosted on @kaggle
https://lux-ai.org/
Apache License 2.0
897 stars 152 forks source link

Node error when running Python agent #131

Open jwood803 opened 2 years ago

jwood803 commented 2 years ago

After initial installations, when I try to run the node command to run the Python agent, I seem to get this error:

UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, unlink 
'C:\Users\jw\Downloads\simple.tar\simple\errorlogs\match_rbTjSvgatNxY\agent_0.log'

Restarted to see if another process had a handle on that location, but I still get the same error.

Node version is 14.17.5 Python version is 3.6.12 :: Anaconda custom (64-bit)

If any other logging is needed, just let me know.

StoneT2000 commented 2 years ago

This is likely a quirk of the CLI tool on windows systems. This is usually not a issue though. Did a replay file still generate?

jwood803 commented 2 years ago

It didn't. The folder generated in the "errorlogs" folder, but that was also empty.

StoneT2000 commented 2 years ago

Is this powershell or command prompt?

jwood803 commented 2 years ago

It's happening with both, actually.

StoneT2000 commented 2 years ago

Can you try running the command but specify --out=replay.json as an argument? replay.json should pop up in the directory

xarthurx commented 2 years ago
-=-=-=-=-=-=-=-=-=-=-=-| [INFO] match_KPRHIS4oBObW |-=-=-=-=-=-=-=-=-=-=-=-

[INFO] (match_KPRHIS4oBObW) - Design: lux_ai_2021 | Initializing match - ID: KPRHIS4oBObW, Name: match_KPRHIS4oBObW
{
  ranks: [
    { rank: 1, agentID: 0, name: 'main.py' },
    { rank: 1, agentID: 1, name: 'main.py' }
  ],
  replayFile: 'replay.json',
  seed: 452970908
}
(node:24548) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, unlink 'C:\Users\xarthur\source\repos\lux\simple\errorlogs\match_KPRHIS4oBObW\agent_0.log'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:24548) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:24548) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Full cmd output is here. The reply.json did get generated, thought I'm not sure if that's the correct one. The two bot from main.py just walk back and forth between two tiles (default main.py).

StoneT2000 commented 2 years ago

Yeah that's the default bot. Looks like it's working then. For now ignore the unlink bug

jwood803 commented 2 years ago

Can you try running the command but specify --out=replay.json as an argument? replay.json should pop up in the directory

Ran it again in Powershell. It doesn't seem to create the replay, though.

PS C:\Users\jw\Downloads\simple.tar\simple> lux-ai-2021 main.py main.py --out=replay.json
>>

-=-=-=-=-=-=-=-=-=-=-=-| [INFO] match_3mSFqQapxOsj |-=-=-=-=-=-=-=-=-=-=-=-

[INFO] (match_3mSFqQapxOsj) - Design: lux_ai_2021 | Initializing match - ID: 3mSFqQapxOsj, Name: match_3mSFqQapxOsj
{
  ranks: [
    { rank: 1, agentID: 0, name: 'main.py' },
    { rank: 2, agentID: 1, name: 'main.py' }
  ],
  replayFile: 'replay.json',
  seed: 220065719
}
(node:7836) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, unlink 'C:\Users\jw\Downloads\simple.tar\simple\errorlogs\match_3mSFqQapxOsj\agent_0.log'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:7836) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

However, it may just be me having this issue, so I'll keep messing around with it to see if I can generate the replay. Thanks for all the advice!

StoneT2000 commented 2 years ago

For now, you can stick to using kaggle-environments or use WSL and the CLI tool or use the docker cli tool.

Nosferican commented 2 years ago

Same behavior here on Windows as well. I tried running it w/my Mac... It requires sudo but looking at the replays, all commands are empty. Tried using the Docker image and everything worked. I guess the recommendation should be to just use the Docker image.

aaronhance commented 2 years ago

Same issue here Win10 tried lots of different things, file permissions, run as admin, different npm versions, clearing npm cache, closing applications, restarting and various combinations of them. Similar issue on latest Ubuntu + node.

StoneT2000 commented 2 years ago

And on ubuntu? What's your output when running on ubuntu

aaronhance commented 2 years ago

And on ubuntu? What's your output when running on ubuntu

On install.

`npm ERR! code EACCES

npm ERR! syscall access npm ERR! path /usr/local/lib npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib' npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib' npm ERR! } npm ERR! `

When run as root.

`> node-gyp rebuild

2021/10/13 23:18:45.728243 cmd_run.go:1002: WARNING: cannot create user data directory: cannot create "/nonexistent/snap/node/5322": mkdir /nonexistent: permission denied cannot create user data directory: /nonexistent/snap/node/5322: Permission denied

ssh2@1.5.0 install /usr/local/lib/node_modules/@lux-ai/2021-challenge/node_modules/ssh2 node install.js

2021/10/13 23:18:45.922920 cmd_run.go:1002: WARNING: cannot create user data directory: cannot create "/nonexistent/snap/node/5322": mkdir /nonexistent: permission denied cannot create user data directory: /nonexistent/snap/node/5322: Permission denied `

StoneT2000 commented 2 years ago

appears to be a different issue @aaronhance. Can you use

sudo npm i -g @lux-ai/2021-challenge@latest

instead?

aaronhance commented 2 years ago

appears to be a different issue @aaronhance. Can you use

sudo npm i -g @lux-ai/2021-challenge@latest

instead?

Seems to work now, despite installation errors https://gist.github.com/aaronhance/1d6485c2944581589fe8b944e7e12576

StoneT2000 commented 2 years ago

You can ignore the install errors. They don't mean anything relevant to the engine

Vadimcg commented 2 years ago

Windows 10 python 3.9.5 after lux-ai-2021 main.py main.py --out=replay.json got: `-=-=-=-=-=-=-=-=-=-=-=-| [INFO] match_IE9xdjvBDnqM |-=-=-=-=-=-=-=-=-=-=-=-

[INFO] (match_IE9xdjvBDnqM) - Design: lux_ai_2021 | Initializing match - ID: IE9xdjvBDnqM, Name: match_IE9xdjvBDnqM { ranks: [ { rank: 1, agentID: 0, name: 'main.py' }, { rank: 1, agentID: 1, name: 'main.py' } ], replayFile: 'replay.json', seed: 364570344 } node:internal/process/promises:246 triggerUncaughtException(err, true / fromPromise /); ^

[Error: EPERM: operation not permitted, unlink 'C:\work\kaggle\lux\errorlogs\match_IE9xdjvBDnqM\agent_0.log'] { errno: -4048, code: 'EPERM', syscall: 'unlink', path: 'C:\work\kaggle\lux\errorlogs\match_IE9xdjvBDnqM\agent_0.log' }`

StoneT2000 commented 2 years ago

This error is okay @Vadimcg, you can ignore it