vscode-marimo icon indicating copy to clipboard operation
vscode-marimo copied to clipboard

Error: Invalid NAME when creating a new notebook

Open my1e5 opened this issue 7 months ago • 6 comments
trafficstars

I'm trying to use the marimo extension on Windows 10 and getting an error with the file name/paths it generates. I'm using uvx and sandbox but it happens without those settings too.

{
  "marimo.marimoPath": "uvx marimo",
  "marimo.sandbox": true
}

To reproduce, run open the Command Palette and execute

marimo: Create new marimo notebook

and enter a name (e.g. foo).

This creates a file called foo.py and a command is automatically executed in the terminal (Git Bash in my case)

$ uvx marimo --yes edit c:\Users\my1e5\Projects\notebooks --host=localhost --port=2818 --headless --no-token --sandbox --watch
Running in a sandbox: uv run --isolated --no-project --with-requirements C:\Users\my1e5\AppData\Local\Temp\tmp7ybiil8n.txt --refresh marimo --yes edit c:Usersmy1e5Projectsnotebooks --host=localhost --port=2818 --headless --no-token --watch
Installed 36 packages in 3.19s
Error: Invalid NAME - c:Usersmy1e5Projectsnotebooks is not a Python or Markdown file

It looks like the foo.py file path isn't added to command properly? It just stops at \notebooks which is the folder I'm in. Also, I don't know if this a Windows/Git Bash thing, but maybe the file path gets formatted wrong because it comes out as c:Usersmy1e5Projectsnotebooks?

System and Version info

Name: marimo
Id: marimo-team.vscode-marimo
Description: Run marimo in VSCode
Version: 0.5.1
Publisher: marimo.io
VS Marketplace Link: https://marketplace.visualstudio.com/items/?itemName=marimo-team.vscode-marimo

Version: 1.100.0-insider (user setup)
Commit: 174af221c9ea2ccdb64abe4aab8e1a805e77beae
Date: 2025-04-09T05:05:17.975Z
Electron: 34.4.1
ElectronBuildId: 11317338
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

my1e5 avatar Apr 09 '25 15:04 my1e5

Looks like an issue in the extension when using windows: c:\Users\my1e5\Projects\notebooks gets reduced to c:Usersmy1e5Projectsnotebooks and fails. Definitely a bug

mscolnick avatar Apr 09 '25 16:04 mscolnick

@my1e5, this should be fixed now. can you try out version ^0.6.0

mscolnick avatar Apr 27 '25 16:04 mscolnick

Just tried the same steps with 0.6.3 but I'm getting a different error now.

$ uvx marimo --yes edit c:\Users\my1e5\Projects\Test\marimo-test --host=localhost --port=2818 --headless --no-token --sandbox --watch
Running in a sandbox: uv run --isolated --no-project --compile-bytecode --with-requirements C:\Users\my1e5\AppData\Local\Temp\tmpxmmmym1w.txt --refresh marimo --yes edit c:Usersmy1e5ProjectsTestmarimo-test --host=localhost --port=2818 --headless --no-token --watch
Installed 36 packages in 3.34s
error: Failed to bytecode-compile Python file in: C:\Users\my1e5\AppData\Local\uv\cache\builds-v0\.tmpmfZcxq\Lib\site-packages
  Caused by: Failed to create temporary script file
  Caused by: failed to write to file `C:\Users\my1e5\AppData\Local\uv\cache\.tmpkm7FDB\pip_compileall.py`: The requested operation cannot be performed on a file with a user-mapped section open. (os error 1224)

System and Version info

$ uv --version
uv 0.6.17 (8414e9f3d 2025-04-25)

Name: marimo
Id: marimo-team.vscode-marimo
Description: Run marimo in VSCode
Version: 0.6.3
Publisher: marimo.io
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=marimo-team.vscode-marimo

Version: 1.100.0-insider (user setup)
Commit: f56819db693dba84feb3716e278b5be0a7378633
Date: 2025-04-17T05:10:42.956Z
Electron: 34.4.1
ElectronBuildId: 11317338
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

my1e5 avatar Apr 28 '25 09:04 my1e5

Unsure if this is a problem with uv now. can you remove your marimoPath and not use sandbox for now. The README has a few other instructions for configuration.

mscolnick avatar Apr 28 '25 12:04 mscolnick

I think the issue might be a mixture of the --sandbox flag and a difference between using forward/backward slashes. I just tested these differentuxv marimo commands on their own. My default terminal is Git Bash.

Backward slashes

with --sandbox

$ uvx marimo --yes edit c:\Users\my1e5\Projects\Test\marimo-test --host=localhost --port=2818 --headless --no-token --watch --sandbox
Running in a sandbox: uv run --isolated --no-project --compile-bytecode --with-requirements C:\Users\my1e5\AppData\Local\Temp\tmpav3tajlf.txt --refresh marimo --yes edit c:Usersmy1e5ProjectsTestmarimo-test --host=localhost --port=2818 --headless --no-token --watch
Installed 36 packages in 2.82s
error: Failed to bytecode-compile Python file in: C:\Users\my1e5\AppData\Local\uv\cache\builds-v0\.tmpkQwa74\Lib\site-packages
  Caused by: Failed to create temporary script file
  Caused by: failed to write to file `C:\Users\my1e5\AppData\Local\uv\cache\.tmp70jug0\pip_compileall.py`: The requested operation cannot be performed on a file with a user-mapped section open. (os error 1224)

without --sandbox

$ uvx marimo --yes edit c:\Users\my1e5\Projects\Test\marimo-test --host=localhost --port=2818 --headless --no-token --watch
Error: Invalid NAME - c:Usersmy1e5ProjectsTestmarimo-test is not a Python or Markdown file

Forward slashes

with --sandbox

$ uvx marimo --yes edit c:/Users/my1e5/Projects/Test/marimo-test --host=localhost --port=2818 --headless --no-token --watch --sandbox
Running in a sandbox: uv run --isolated --no-project --compile-bytecode --with-requirements C:\Users\my1e5\AppData\Local\Temp\tmpoo3_waeh.txt --refresh marimo --yes edit c:/Users/my1e5/Projects/Test/marimo-test --host=localhost --port=2818 --headless --no-token --watch
Installed 36 packages in 2.86s
error: Failed to bytecode-compile Python file in: C:\Users\my1e5\AppData\Local\uv\cache\builds-v0\.tmprwBS5R\Lib\site-packages
  Caused by: Failed to create temporary script file
  Caused by: failed to write to file `C:\Users\my1e5\AppData\Local\uv\cache\.tmprCt9Rq\pip_compileall.py`: The requested operation cannot be performed on a file with a user-mapped section open. (os error 1224)

without --sandbox

$ uvx marimo --yes edit c:/Users/my1e5/Projects/Test/marimo-test --host=localhost --port=2818 --headless --no-token --watch

        Create or edit notebooks in your browser 📝

        ➜  URL: http://localhost:2818

my1e5 avatar Apr 28 '25 13:04 my1e5

thank you for the detailed repro. this seems to be an issue on marimo proper then, and not the vscode extension: https://github.com/marimo-team/marimo

@my1e5 do you mind filing an issue on https://github.com/marimo-team/marimo/issues with your findings. i think fixing it there, should fix this issue

mscolnick avatar Apr 28 '25 17:04 mscolnick

Hi, we've launched a new VSCode extension at https://github.com/marimo-team/marimo-lsp (readme). It may mean this issue is resolved or no longer applicable. If the issue still exists, please file the issue on over on the new Issues page.

mscolnick avatar Nov 05 '25 18:11 mscolnick