Failed to resolve module path for `MOGGKernelAPI`

I get the following error related to MOGGKernelAPI

python3 addition.py
Traceback (most recent call last):
  File "/home/ubu/code_examples/modular/forum/.pixi/envs/default/lib/python3.13/site-packages/max/engine/api.py", line 424, in load
    _model = self._impl.compile_from_object(
        model._module._CAPIPtr,  # type: ignore
        custom_extensions_final,
        model.name,
    )
ValueError: Failed to resolve module path for `MOGGKernelAPI`

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ubu/code_examples/modular/forum/addition.py", line 25, in <module>
    out = add_tensors(a, b)
  File "/home/ubu/code_examples/modular/forum/addition.py", line 16, in add_tensors
    model = session.load(graph)
  File "/home/ubu/code_examples/modular/forum/.pixi/envs/default/lib/python3.13/site-packages/max/engine/api.py", line 430, in load
    raise RuntimeError(
    ...<5 lines>...
    ) from e
RuntimeError: Failed to compile the model. Please file an issue, all models should be correct by construction and this error should have been caught during construction.
For more detailed failure information run with the environment variable `MODULAR_MAX_DEBUG=True`.

When running the file addition.py (below)

import numpy as np
from max import engine
from max.driver import CPU
from max.dtype import DType
from max.graph import DeviceRef, Graph, TensorType, ops


def add_tensors(a: np.ndarray, b: np.ndarray) -> np.ndarray:
    input_type = TensorType(dtype=DType.float32, shape=(1,), device=DeviceRef.CPU())
    with Graph("simple_add_graph", input_types=(input_type, input_type)) as graph:
        lhs, rhs = graph.inputs
        out = ops.add(lhs, rhs)
        graph.output(out)

    session = engine.InferenceSession(devices=[CPU()])
    model = session.load(graph)
    output = model.execute(a, b)[0]
    result = output.to_numpy()
    return result


if __name__ == "__main__":
    a = np.array([1.0], dtype=np.float32)
    b = np.array([2.0], dtype=np.float32)
    out = add_tensors(a, b)

with this following pixi.toml

[workspace]
authors = ["AndPotap"]
channels = ["https://conda.modular.com/max-nightly", "conda-forge"]
name = "test"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
python = "==3.13"
modular = "==26.2.0.dev2026020905"

However, if I change my pixi.toml to a previous version it works fine. For example

[workspace]
authors = ["AndPotap"]
channels = ["https://conda.modular.com/max-nightly", "conda-forge"]
name = "test"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
python = "==3.13"
modular = "==26.1.0.dev2026010105"

How can I fix this error Failed to resolve module path for MOGGKernelAPI when using the latest modular nightly >= 26.2

I was able to fix this issue. I was enabling my pixi environment while standing on a python venv environment (I had my terminal setup so that I immediately activates the environment that I’m using for a current project). Once I opened a terminal that was not activating the python venv then I was able to get the code to work.