Skip to main content
Log in

Add MAX/Mojo to a conda project

Although we recommend using Magic to manage your virtual environments and packages for MAX and Mojo, you can also add MAX/Mojo to a conda project.

Here's how to create a new conda environment with MAX/Mojo:

conda create -n max-project -c conda-forge -c https://conda.modular.com/max/ \
python=3.11 max=* -y

Then activate the environment and you'll have access to mojo:

conda activate max-project
mojo --version
note

The max package includes Mojo. There's no separate package for Mojo.

Run a MAX example​

Each example in our MAX repo includes a conda environment.yml file with the environment named max-repo. For example, here's how you can run one of the MAX inference examples in a conda environment:

git clone https://github.com/modularml/max.git
cd max/examples/inference/bert-python-torchscript
conda activate max-repo
bash run.sh

Run a Mojo example​

Each example in our MAX repo includes a conda environment.yml file with the environment named max-repo. For example, here's how you can run one of the MAX inference examples in a conda environment:

git clone https://github.com/modularml/mojo.git
cd mojo/examples
conda create -n mojo-repo -c conda-forge -c https://conda.modular.com/max/ \
python=3.11 max=* -y
conda activate mojo-repo
mojo hello_interop.mojo
Hello Mojo πŸ”₯!
9
6
3
Hello from Python!
I can even print a numpy array: [1 2 3]
caution

You might encounter issues if you invoke magic within a conda virtual environment. It's best if you don't mix the two tools.

For more information about using conda, see the conda documentation.

Was this page helpful?