Skip to content
HY Devlog
Go back

Reading the ML-Agents Install Docs: Python 3.10.12 Is a Ceiling, Not a Recommendation

Putting on-device AI into a game project meant bringing in Sentis, and while digging into that I clipped the ML-Agents Toolkit installation docs. Searching for Sentis material pulls ML-Agents pages along with it, because ML-Agents is one of the things that uses Sentis.

The document itself is a procedure: install Unity → set up a Python environment with Conda → install the Unity package → install the Python package. Follow it and it works.

What it almost entirely lacks is the “why.” Why Conda specifically, why a three-part version like 3.10.12, why the install order matters — none of that is stated. And those reasons line up exactly with where installation fails. So I filled in that side.

Table of contents

Table of contents

Why this toolkit comes in two pieces

This is the root of why installation is fiddly. ML-Agents is not one package. From the official manual:

The C# package does not contain the machine learning algorithms for training behaviors … The machine learning algorithms that orchestrate training are part of the companion Python package.

Which splits as:

During training the two talk over a local socket: Unity sends observations, Python returns actions. That’s why their versions have to match, and why installation splits across the Unity Package Manager and pip. It’s also why the document insists you install a Python package version matching your Unity ML-Agents package version.

Python 3.10.12 is a ceiling, not a recommendation

The document says only:

Install Python 3.10.12 using Conda

Nothing about why 3.10.12. The mlagents package metadata on PyPI answers it:

Requires-Python: <=3.10.12, >=3.10.1

There’s an upper bound. Not even 3.10.13, let alone 3.11. That’s an unusually narrow range for a modern Python package. If your system Python is 3.11 or 3.12, pip install mlagents refuses outright.

That’s also why the document tells you to use Conda or Mamba. venv only makes a virtual environment from an already installed interpreter, so if 3.10.12 isn’t on the system there’s nothing to build from. Conda fetches the interpreter itself at the version you ask for.

conda create -n mlagents python=3.10.12 && conda activate mlagents

That single line is the most important one in the document. Skip it and proceed with the system Python, and none of the later steps matter.

Pairing up the versions

Filling in the values behind the links the document gives:

Current
Latest releaseRelease 23 (2025-09-02)
Unity packagecom.unity.ml-agents 4.0.3
Python packagemlagents 1.1.0 (2024-10-05)
Minimum Unity6000.0 or later

One thing stands out: the Python package has been sitting still since October 2024. Release 23 shipped in September 2025 and mlagents on PyPI hasn’t moved. So the document’s pip install mlagents==1.1.0 is still the right value.

The release cadence is worth noting too: Release 19 (2022-01) → 20 (2022-11) → 21 (2023-10) → 22 (2024-10) → 23 (2025-09) — roughly annual. It’s now September 2026, a year on from Release 23, which isn’t unusual at that cadence. Still, it’s worth knowing going in that this isn’t a fast-moving project.

What needs adjusting today

The clipping is the 4.0 documentation, and a few things have already drifted.

Package version. The document is titled 4.0.1; the current Unity package is 4.0.3.

The Preview Packages step. The document includes:

Enable Preview Packages under the Advanced drop-down list if the package doesn’t appear.

com.unity.ml-agents is now published as a released package. Adding it by name finds it, so this step usually isn’t needed. It reads like a leftover from older documentation.

The PyTorch line. For Windows it gives:

pip3 install torch~=2.2.1 --index-url https://download.pytorch.org/whl/cu121

torch 2.2.1 with cu121 is an early-2024 combination. On a recent GPU that build may not support your architecture, so it’s safer to pick the CUDA build that matches your hardware from the PyTorch installation guide the document also links. Just don’t stray outside the torch range mlagents requires — move up while checking rather than jumping straight to latest.

Sentis or Inference Engine?

The part that runs the trained model inside Unity goes by two names, and ML-Agents’ own documentation splits between them.

And Unity’s current inference package is com.unity.ai.inference 2.3.0, described as:

Inference Engine is a neural network inference library for Unity. It lets you import trained neural network models into Unity and run them in real-time with your target device’s compute resources, such as central processing unit (CPU) or graphics processing unit (GPU).

So they’re two names for the same thing, with the older one still sitting in the ML-Agents docs. Meaning you have to search both Sentis and Inference Engine when looking for material. What that inference layer actually does I wrote up separately in accessing tensor data in Sentis.

That also settles one more piece of the structure: training is Python, inference is Unity. No Python goes into your build. Training leaves you an .onnx model file, and the game runs it through the Inference Engine.

If you only need Sentis, you don’t need this install

As my own route here shows, it’s easy to drift from Sentis into ML-Agents. But the relationship is containment, not equivalence.

So if the goal is “run a model I already have inside the game”, adding com.unity.ai.inference alone is enough, and the Conda, PyTorch and Python packages in this document are all unnecessary. This installation procedure only earns its keep when the goal is “train an agent inside the game.”

If you landed on the ML-Agents install docs while looking for Sentis material, sorting out which of the two you actually need saves the most time.

Which of the two install methods to pick

The document offers two paths, and the criterion reduces to one question: do you need the example environments?

Learning it for the first time, Advanced is effectively the default. Getting a feel for observation, action and reward design without running something like 3D Ball is hard.

The document also explains why you specify a branch when cloning:

git clone --branch release_23 https://github.com/Unity-Technologies/ml-agents.git

Omit --branch and you get develop, which may contain experimental or unstable changes.

Where the order matters

At the end of the advanced install the document emphasises this:

Install the packages in this order. The mlagents package depends on mlagents_envs. Installing them in the other order will download mlagents_envs from PyPi, which can cause version mismatches.

python -m pip install ./ml-agents-envs
python -m pip install ./ml-agents

Reverse the order and something wrong gets installed silently. Install mlagents first and pip pulls its dependency mlagents_envs from PyPI — so the released build goes in rather than the source you just cloned. You cloned to modify it, and something else is running. No error appears, which makes it hard to spot.

The grpcio workaround is the same kind of thing.

conda install "grpcio=1.48.2" -c conda-forge

When the wheel build fails, you take a prebuilt one from conda-forge instead. A common pattern on projects pinned to a narrow Python range.

Finally, verification is one line:

mlagents-learn --help

If it lists the available parameters, the Python side is done.

Summary

References


Share this post:

Previous Post
Subscribing to InputAction Directly: The Lifetime of Delegate-Based Input
Next Post
Character Encodings: Unicode Is Not Two Bytes