How do I run Python code on ICP?

Are there any relevant documents for reference at present?

4 Likes

There aren’t at the moment. Broadly, the canisters can run any language that compiles down to WebAssembly (wasm), and Python would need its interpreter bundled with it in the wasm module, there looks like being some progress on this though: GitHub - appcypher/awesome-wasm-langs: 😎 A curated list of languages that compile directly to or have their VMs in WebAssembly

2 Likes

Thank you for your reply.

It might not be too far out there to create a canister that runs some Python: Using GitHub - RustPython/RustPython: A Python Interpreter written in Rust you can execute Python from Rust, and this compiles to Wasm. So someone could probably write a Python CDK based on that.

(I did some experiments last year, but got distracted.)

10 Likes

This would be AWESOME!!! Really hope official support for this is considered :pray:

2 Likes

This exists now, Kybra is a Python CDK created by my company Demergent Labs: GitHub - demergent-labs/kybra: Python CDK for the Internet Computer

7 Likes

Sorry for bumping this back up the list. Don’t kill me.

Has Kybra (by Demergent Labs) continued to develop? Are there more solutions to running Python on the IC? How easy is making a simple program like this GitHub - jsull9/Test-, and turning it into a dapp hosted on the IC…

Not concerned about the graphics/GUI side of things & Turtle isn’t exactly worth my time for this not trying to make it fancy either atm lol I’m just trying to prove it can be done/ do it…

dm me via Discord if easier

Kybra is not being developed as rapidly as Azle, it is right now frozen in beta, but it has many of the ICP APIs.

If you would like to build ICP canisters using the ICP APIs, please try Kybra. You must understand that the ICP APIs are what are mostly provided, you can’t expect to pull every package off of PyPI and have it work.

But for pure ICP canister development using the ICP APIs, there is a lot available. If you have issues with the APIs, please let me know.

1 Like