[BUG]: matmul.mojo does not run without changing Python.add_to_path()
Bug description
On line 74 of /examples/matmul.py it reads
Python.add_to_path(".")
With that code, I get the following error:
Unhandled exception caught during execution: No module named 'pymatmul'
If I change the line to be:
Python.add_to_path("./examples")
It works fine.
I would just submit a PR but since I'm pretty sure this would have been found earlier and I'm a Mojo n00b, it may be OS/environment independent.
Steps to reproduce
Run /examples/matmul.mojo from either VS Code or via the CLI (mojo matmul.mojo).
Result:
Unhandled exception caught during execution: No module named 'pymatmul'
Expect (though the numbers will be different of course):
CPU Results
Python: 0.006 GFLOPS
Numpy: 168.142 GFLOPS
Naive: 6.533 GFLOPS 1175.68x Python 0.04x Numpy
Vectorized: 22.751 GFLOPS 4094.08x Python 0.14x Numpy
Parallelized: 50.570 GFLOPS 9100.25x Python 0.30x Numpy
Tiled: 60.557 GFLOPS 10897.54x Python 0.36x Numpy
Unrolled: 65.251 GFLOPS 11742.19x Python 0.39x Numpy
Accumulated: 643.236 GFLOPS 115753.34x Python 3.83x Numpy
System information
- What OS did you do install Mojo on ?
Mac OS Ventura 14.1.2 (MacBook Pro M2)
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 0.6.1 (876ded2e)
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.3.1 (589ce200)
Hi! I have similar error, but adding Python.add_to_path("./examples") didn't solve it.
Error:
Unhandled exception caught during execution: No module named 'pymatmul' /Users/spiderman/.modular/pkg/packages.modular.com_mojo/bin/mojo: error: execution exited with a non-zero result: 1
Maybe you came accros different solution?
my set up: mac book pro m1 mojo 24.3.0 (9882e19d) modular 0.8.0 (39a426b5)
Hi @billbliss resolved in an upcoming release, you can test with modular install nightly/mojo if you want to try it now.