-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Description
I installed Mojo using Pixi; running pixi shell followed by mojo run main.mojo works fine. I also installed the Python and Mojo extensions in VSCode, but pressing F5 results in an error from Python. Alternatively, if I want to use VSCode for debugging, are there other ways or more detailed reference links? Thank you in advance.
shell info
stephanie@swift hello-world % pwd
/Users/stephanie/Desktop/mojo-project/hello-world
stephanie@swift hello-world % pixi shell
(hello-world) stephanie@swift hello-world % mojo --version
Mojo 0.26.2.0.dev2026030616 (c1bd447c)
(hello-world) stephanie@swift hello-world % mojo run main.mojo
z: 17
x: 15
error info
cd /Users/stephanie/Desktop/mojo-project/hello-world ; /usr/bin/env /usr/bin/python3 /Users/stephanie/.vscode/extensions/ms-python
.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 61802 -- /Users/stephanie/Desktop/mojo-project/hello-world/main.mojo
Traceback (most recent call last):
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/stephanie/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
cli.main()
File "/Users/stephanie/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 508, in main
run()
File "/Users/stephanie/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 358, in run_file
runpy.run_path(target, run_name="__main__")
File "/Users/stephanie/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 309, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "/Users/stephanie/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 283, in _get_code_from_file
code = compile(f.read(), fname, "exec")
File "/Users/stephanie/Desktop/mojo-project/hello-world/main.mojo", line 1
fn add_two(y: Int):
^
SyntaxError: invalid syntax
main.mojo
fn add_two(y: Int):
# y += 2 # This would cause a compiler error because `y` is immutable
# We can instead make an explicit copy:
var z = y
z += 2
print("z:", z)
def main() raises:
var x = 15
add_two(x)
print("x:", x)
vscode lanch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Mojo Debug via Pixi",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/main.mojo",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"env": {
"PATH": "/Users/stephanie/Desktop/mojo-project/hello-world/.pixi/envs/default/bin:${env:PATH}"
}
}
]
}
https://marketplace.visualstudio.com/items?itemName=modular-mojotools.vscode-mojo
System information
- Provide the system information by running
pixi info.
pixi info
System
------------
Pixi version: 0.59.0
Platform: osx-arm64
Virtual packages: __unix=0=0
: __osx=26.2=0
: __archspec=1=m2
Cache dir: /Users/stephanie/Library/Caches/rattler/cache
Auth storage: /Users/stephanie/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /Users/stephanie/.pixi/bin
Environment dir: /Users/stephanie/.pixi/envs
Manifest dir: /Users/stephanie/.pixi/manifests/pixi-global.toml
Workspace
------------
Name: hello-world
Version: 0.1.0
Manifest file: /Users/stephanie/Desktop/mojo-project/hello-world/pixi.toml
Last updated: 07-03-2026 10:22:57
Environments
------------
Environment: default
Features: default
Channels: https://conda.modular.com/max-nightly, conda-forge
Dependency count: 1
Dependencies: mojo
Target platforms: osx-arm64
Prefix location: /Users/stephanie/Desktop/mojo-project/hello-world/.pixi/envs/default
- Provide version information for MAX (includes Mojo) by pasting the output of
pixi list max.
pixi list max
Error: × No packages found in 'default' environment for 'osx-arm64' platform.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels