---
title: Luna needs CPython 3.12 or later
description: A deploy of Python lunas stopped because the CLI found an older Python on this machine.
related:
  - /lunas/write-lunas-in-python
  - /develop/deploy-an-app
  - /cli
---

Before a deploy, the `luna` CLI loads your Python lunas on your machine to read what they define. It runs them with the Python it finds, and the Python SDK refuses any Python older than 3.12.

## Issue

`luna deploy` stops while it loads the app, and the message ends with the version it found. `luna dev` shows the same message.

```text
error: loading the app failed:
Traceback (most recent call last):
  ...
RuntimeError: Luna needs CPython 3.12 or later, and this is <VERSION>
```

When there is no `python3` at all, the message starts with `running python3 (CPython 3.12 or later is required)` instead.

## Cause

The CLI runs the command `python3` from your `PATH`, unless `LUNA_PYTHON` names another. The `python3` that comes with an operating system can be older than 3.12.

Only apps with Python lunas need Python on your machine. An app written only in TypeScript never runs it.

## Solution

Install CPython 3.12 or later, then point the CLI at it with `LUNA_PYTHON`.

```bash
export LUNA_PYTHON=<PATH_TO_PYTHON_3_12_OR_LATER>
```

Run the same `luna deploy` or `luna dev` again from that shell. Add the `export` line to your shell's startup file to keep it for every session. In CI, set `LUNA_PYTHON` in the job's environment.

[Write lunas in Python](/lunas/write-lunas-in-python) covers the rest of the Python SDK.
