Skip to content

Commit a07cb6a

Browse files
committed
Tidy package install example
1 parent a5da36d commit a07cb6a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

_extensions/pyodide/qpyodide-document-engine-initialization.js

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ globalThis.qpyodideInstance = await import(
3535

3636
// Load the `micropip` package to allow installation of packages.
3737
await mainPyodide.loadPackage("micropip");
38+
await mainPyodide.runPythonAsync(`
39+
import micropip
40+
`);
3841

3942
// Load the `matplotlib` package with necessary environment hook
4043
await mainPyodide.loadPackage("matplotlib");

docs/qpyodide-code-cell-demo.qmd

+4-2
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,17 @@ await micropip.install("seaborn")
161161
Then, we have:
162162

163163
```{pyodide-python}
164+
# External Python package
164165
import seaborn as sns
165166
167+
# Core Pyodide packages
168+
import numpy as np
166169
import pandas as pd
167170
168171
data = np.random.multivariate_normal([0, 0], [[5, 2], [2, 2]], size=2000)
169172
data = pd.DataFrame(data, columns=['x', 'y'])
170173
171-
sns.distplot(data['x'])
172-
sns.distplot(data['y']);
174+
sns.displot(data['x']);
173175
```
174176

175177
## Graphing

0 commit comments

Comments
 (0)