Lux-Design-S1 icon indicating copy to clipboard operation
Lux-Design-S1 copied to clipboard

Node error when running Python agent

Open jwood803 opened this issue 3 years ago • 18 comments

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.

jwood803 avatar Aug 29 '21 20:08 jwood803

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?

StoneT2000 avatar Aug 29 '21 23:08 StoneT2000

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

jwood803 avatar Aug 30 '21 06:08 jwood803

Is this powershell or command prompt?

StoneT2000 avatar Aug 31 '21 14:08 StoneT2000

It's happening with both, actually.

jwood803 avatar Aug 31 '21 15:08 jwood803

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

StoneT2000 avatar Sep 01 '21 01:09 StoneT2000

-=-=-=-=-=-=-=-=-=-=-=-| [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).

xarthurx avatar Sep 01 '21 08:09 xarthurx

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

StoneT2000 avatar Sep 01 '21 12:09 StoneT2000

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!

jwood803 avatar Sep 01 '21 12:09 jwood803

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

StoneT2000 avatar Sep 01 '21 13:09 StoneT2000

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.

Nosferican avatar Oct 05 '21 22:10 Nosferican

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.

aaronhance avatar Oct 13 '21 04:10 aaronhance

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

StoneT2000 avatar Oct 13 '21 16:10 StoneT2000

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

[email protected] 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 `

aaronhance avatar Oct 13 '21 22:10 aaronhance

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

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

instead?

StoneT2000 avatar Oct 14 '21 02:10 StoneT2000

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

aaronhance avatar Oct 14 '21 04:10 aaronhance

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

StoneT2000 avatar Oct 14 '21 04:10 StoneT2000

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' }`

Vadimcg avatar Nov 04 '21 13:11 Vadimcg

This error is okay @Vadimcg, you can ignore it

StoneT2000 avatar Nov 05 '21 00:11 StoneT2000