Create a project
MAX is available as a conda package and we recommend installing it into a
virtual environment with the magic
CLI. Magic handles your
project-specific virtual environments, package dependencies, package lock
files, and more. You can also use Magic to install different versions such as
MAX nightly builds) for different
projects.
Create a Python project with MAX
You can create a new project with magic init
.
Each project has its own Python version and package dependencies.
Here's how to create a project that includes the MAX Python API:
-
Create a project in a new path with
magic init
:magic init my-project
magic init my-project
-
Add the MAX Python package with
magic add
:cd my-project
cd my-project
magic add max
magic add max
This ensures that you always have the latest version of MAX. You can instead specify the version using Python version operators. For example, here's how to use any version compatible with v24.4:
magic add "max~=24.4"
magic add "max~=24.4"
That's it.
You can check the installed max
version like this:
magic run python3 -c 'from max import engine; print(engine.__version__)'
magic run python3 -c 'from max import engine; print(engine.__version__)'
24.4.0-59977802-release
24.4.0-59977802-release
To learn more, see the Magic documentation.
Create a project with MAX nightly
Nightly builds let you try the latest APIs and bug fixes, but they can also
include new bugs. However, you can safely use the nightly build in one project
without affecting your other projects, because every project you create with
magic
has its own package dependencies.
-
Create a new project and specify the
max-nightly
channel with themagic init -c
option:magic init nightly-project \
-c conda-forge -c https://conda.modular.com/max-nightlymagic init nightly-project \
-c conda-forge -c https://conda.modular.com/max-nightlyWhen you include the
-c
(--channel
) option, you must specify all channels for your project. Be sure to includeconda-forge
(or another conda channel) to install packages other than MAX.Or, update an existing project to use nightlies by changing the
conda.modular.com/max
channel tomax-nightly
. For example:pixi.toml[project]
channels = ["conda-forge", "https://conda.modular.com/max-nightly"][project]
channels = ["conda-forge", "https://conda.modular.com/max-nightly"] -
Add the MAX package with
magic add
:cd nightly-project
cd nightly-project
magic add max
magic add max
Now this project always has the latest nightly build.
Next steps
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!