Skip to content

[BUG] Scikit-Learn in Mojo. Mojo Debugging #5680

@rcghpge

Description

@rcghpge

Bug description

Actual behavior

Unable to run rigorous debugging for Scikit-Learn model. lldb also shows MOJO_ENABLE_STACK_TRACE_ON_ERROR=1 implementation unable to generate a full summary for debugging.

# lldb output
Current executable set to '/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo' (x86_64).
(lldb) run sklearn.mojo
Process 1717 launched: '/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo' (x86_64)
Process 1717 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1717 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1717 stopped and restarted: thread 7 received signal: SIGCHLD
stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
Unhandled exception caught during execution: invalid syntax (<string>, line 1)
/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo: error: execution exited with a non-zero result: 1
Process 1717 exited with status = 1 (0x00000001)
(lldb) run sklearn_nightly.mojo
Process 1786 launched: '/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo' (x86_64)
Process 1786 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1786 stopped and restarted: thread 7 received signal: SIGCHLD
Process 1786 stopped and restarted: thread 7 received signal: SIGCHLD
Python.evaluate failed for code: iris = __import__('sklearn.datasets').load_iris(); ... : invalid syntax (<string>, line 1)
Stack trace: stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
generate_models outer error: invalid syntax (<string>, line 1)
Full stack trace: stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
Main caught fatal error: invalid syntax (<string>, line 1)
Final stack trace: stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
Exit code: 1
Process 1786 exited with status = 0 (0x00000000)
(lldb)

Expected behavior

Full debugging implementation summary for building Scikit-Learn ML models in Mojo.

Steps to reproduce

  • Please paste or attach the .mojo files that are needed to reproduce the issue.

  • If you are able to reduce the reproduction steps to a small example, this would be much appreciated!

    • Running in a Pixi shell environment with Mojo nightly. See pixi.toml file at root directory for more information.
  • Please quote the command line you used to compile and/or run the example.

export MOJO_ENABLE_STACK_TRACE_ON_ERROR=1
mojo sklearn.mojo
mojo run sklearn.mojo
mojo sklearn_nightly.mojo
mojo run sklearn_nightly.mojo

# lldb
mojo debug mojo
run sklearn.mojo
run sklearn_nightly.mojo
  • If you see a crash or an error message, please paste it in the "actual behavior" above.
# stdout
# lldb output
Current executable set to '/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo' (x86_64).
(lldb) run sklearn.mojo
Process 1717 launched: '/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo' (x86_64)
Process 1717 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1717 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1717 stopped and restarted: thread 7 received signal: SIGCHLD
stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
Unhandled exception caught during execution: invalid syntax (<string>, line 1)
/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo: error: execution exited with a non-zero result: 1
Process 1717 exited with status = 1 (0x00000001)
(lldb) run sklearn_nightly.mojo
Process 1786 launched: '/home/rc/super-palm-tree/.pixi/envs/default/bin/mojo' (x86_64)
Process 1786 stopped and restarted: thread 1 received signal: SIGCHLD
Process 1786 stopped and restarted: thread 7 received signal: SIGCHLD
Process 1786 stopped and restarted: thread 7 received signal: SIGCHLD
Python.evaluate failed for code: iris = __import__('sklearn.datasets').load_iris(); ... : invalid syntax (<string>, line 1)
Stack trace: stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
generate_models outer error: invalid syntax (<string>, line 1)
Full stack trace: stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
Main caught fatal error: invalid syntax (<string>, line 1)
Final stack trace: stack trace was not collected. Enable stack trace collection with environment variable `MOJO_ENABLE_STACK_TRACE_ON_ERROR`
Exit code: 1
Process 1786 exited with status = 0 (0x00000000)
(lldb)
Image
  • If using the Godbolt / Compiler Explorer, share the example link.

    • Not implemented here.
  • Include anything else that might help us debug the issue. Your insights and observations are welcome!

    • Latest test run on Windows 11 Pro. Parrot WSL

System information

  • Provide the system information by running pixi info.
Image
  • Provide version information for MAX (includes Mojo) by pasting the output of pixi list max.
Mojo 0.26.1.0.dev2025121605 (dbaf7bd1)
max = ">=26.1.0.dev2025121605,<27"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssue needs to be routed/triaged to a particular team stillbugSomething isn't workingmojoIssues that are related to mojo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions