Python Code block is using Pyodide which behaves slightly different compared to CPython. Pyodide comes with many built-in packages, e.g.,
matplotlib. So they are ready to be loaded and used.
For more details please see Pyodide - Loading packages.
How to install Python Package¶
In case you want to use a packages that is not pre-installed, be aware that you can install only pure Python wheels or binary wasm32/emscripted wheels. This can be done using
micropip. For example if you want to install
plotly you have to do:
How to install requests package¶
requests package is not available in Pyodide. However you can fetch a given url using the
pyodide.http built-in module.
For more details please see pyodide.http API.
For a fully working example see Python and Requests Package.