Sorry you have installation issues. Please first check if the Packages | Modular are met. Then the main
branch is tracking the nightly releases and pip install modular
installs the latest stable Packages | Modular version which is currently 25.5
. So
git clone https://github.com/modular/modular
cd modular
git checkout modular/v25.5
cd modular/examples/mojo
For pip, it’s highly recommended to use virtual environment so
# make sure no env is active
python -m venv venv
source venv/bin/activate
python -m pip install modular
The modular
package is a meta-package that includes everything such as mojo-compiler
, mojo
(dev dependencies such as formater, LSP etc.) and max
Now check mojo –-version
should match the tag Mojo 25.5.0 (573c06a4)
Then run
mojo mandelbrot.mojo
Number of physical cores: 12
Vectorized: 11.305873239436618 ms
Parallelized: 2.309573 ms
Parallel speedup: 4.895222294093592
For the custom_ops examples, the kernels are meant to be used with max
python graph api so we can run the vector addition example via (cd custom_ops
)
python vector_addition.py
outputs like
Left-hand-side values:
[0.37531552 0.16229668 0.39715832 0.6472096 0.20262577 0.4971949
0.24008769 0.9813841 0.37782624 0.37180763]
Right-hand-side values:
[0.925224 0.32441604 0.32967967 0.30302358 0.36905172 0.57079685
0.35871768 0.14324683 0.10780976 0.15608703]
Graph result:
[1.3005395 0.48671272 0.726838 0.95023316 0.5716775 1.0679917
0.59880537 1.1246309 0.485636 0.5278947 ]
Expected result:
[1.3005395 0.48671272 0.726838 0.95023316 0.5716775 1.0679917
0.59880537 1.1246309 0.485636 0.5278947 ]
Generally for best environment and package/dependency management experience we recommend to use either pixi or uv.
With pixi there’s no need to manually handing venv, python version etc. For example in the case of custom_ops
can do pixi run vector_addition
where pixi handles everything correctly here.
If you’re interested about GPU programming in Mojo, please check out GitHub - modular/mojo-gpu-puzzles: Learn GPU Programming in Mojo🔥 by Solving Puzzles .