# Run MakeCode's Python Code on a Raspberry Pi?

**URL:** <https://forum.makecode.com/t/run-makecodes-python-code-on-a-raspberry-pi/24477>\
**Category:** Arcade\
**Created:** [November 22, 2023, 8:06pm UTC](https://forum.makecode.com/t/run-makecodes-python-code-on-a-raspberry-pi/24477 "2023-11-22T20:06:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MicroGuy](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@MicroGuy](https://forum.makecode.com/u/MicroGuy)\
**Post date:** [November 22, 2023, 8:06pm UTC](https://forum.makecode.com/t/run-makecodes-python-code-on-a-raspberry-pi/24477/1 "2023-11-22T20:06:26Z")

</div>

We cannot run MakeCode on a Raspberry Pi. Our school district blocks RPi internet access. So, our students want to take the Arcade-generated Python code for a game and run it as a pure Python program on a Raspberry Pi 4. Does Microsoft provide the graphics library, sprite files, etc?

For example, what library provides this function?

controller.move\_sprite(…)

[Code.org](http://Code.org), for example uses the p5.play library and it’s open source. Here’s an example of a simple Arcade-generated Python listing of the type we want the kids to run on the RPi’s. Our middle-school students would provide the sprites. Any help is greatly appreciated.

scene.set\_background\_color(0)  
scene.set\_background\_image(img(“”" {garbage-image numbers removed for clarity}  
“”“))  
pizza = sprites.create(img(”“” {garbage-image numbers removed for clarity}]  
“”"),  
SpriteKind.player)  
pizza.x = 50  
pizza.x = 50

def on\_forever():  
mySprite: Sprite = None  
controller.move\_sprite(pizza, 12, 15)  
controller.move\_sprite(mySprite, 100, 100)  
forever(on\_forever)

---

<div class="post-metadata">

**Author:** ![robotosaurus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/robotosaurus/32/19294_2.png) [@robotosaurus](https://forum.makecode.com/u/robotosaurus)\
**Post date:** [January 23, 2024, 5:35pm UTC](https://forum.makecode.com/t/run-makecodes-python-code-on-a-raspberry-pi/24477/2 "2024-01-23T17:35:17Z")

</div>

You can’t do that. But you can install the makecode arcade pi0 os but that would not work with a pi4 only pi0. So Yeah.

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [January 23, 2024, 7:53pm UTC](https://forum.makecode.com/t/run-makecodes-python-code-on-a-raspberry-pi/24477/3 "2024-01-23T19:53:43Z")

</div>

Hi @MicroGuy,

You would not be able to easily interpret/compile MakeCode Python code into a game and run it on a RPi, since MakeCode Python is only an translation layer on top of MakeCode Static TypeScript(JavaScript), which can be run online in the simulator or compiled into executables for different supported hardware.

However, when first compiled to the supported RPi0 hardware in the editor and downloaded to _.elf_ files, these games actually work on most ARM hardware running Linux(RPi0, 1, 2, 3, 4 etc.).

Not only on “pi0” and not requiring the “arcade pi0 os” as @robotosaurus incorrectly/inaccurately claims above.

> [@MakeCode Arcade on Raspberry Pi (including RetroPie, Recalbox, Batocera etc.)](https://forum.makecode.com/t/makecode-arcade-on-raspberry-pi-including-retropie-recalbox-batocera-etc/14267):
>
> With reference to previous correspondence with @richard and @peli, and happy to announce that McAirpos now supports running MakeCode Arcade games natively and with controller support on [Batocera](https://batocera.org) retro-gaming distro in addition to [RetroPie](https://retropie.org.uk), [Recalbox](https://www.recalbox.com) and the [Raspberry Pi OS](https://www.raspberrypi.com/software/) [console](https://en.wikipedia.org/wiki/Linux_console) and presumably other similar ARM hardware and Linux flavours, as well as a new working [Ansible](https://www.ansible.com) playbook template that allows quickly scripted installation onto several devices in parallel in e.g. a classroom, collaborat…

Lacking internet access for your RPis, you could transfer the _.elf_ game files by e.g. USB thumb drives.
