alexmojaki / futurecoder

100% free and interactive Python course for beginners
https://futurecoder.io/
MIT License
1.27k stars 132 forks source link

micropip in pyodide #442

Closed rootsmusic closed 8 months ago

rootsmusic commented 8 months ago

I tried pasting the code block for micropip, but the second line's call to micropip gave a SyntaxError. Is this a bug with pyodide? Thanks.

alexmojaki commented 8 months ago

This is JS, not Python:

await pyodide.loadPackage("micropip");
const micropip = pyodide.pyimport("micropip");
await micropip.install("seaborn");

In particular the const isn't valid Python. But futurecoder doesn't support top-level await.

import seaborn works fine in futurecoder and automatically installs it with micropip, so you don't need to do anything.

But futurecoder has no visual output section for you to see plots.

Try https://papyros.dodona.be/?locale=en&language=Python