Comments (2)
Hi @mneil, this seems to work, thanks! My handleSubmit() now looks like this:
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const pyodide = await loadPyodide({
indexURL: 'https://cdn.jsdelivr.net/pyodide/v0.26.1/full/'
});
await pyodide.loadPackage('micropip');
pyodide.pyimport('micropip');
const wheel = 'my-redacted-wheel.whl'; // TODO!
pyodide.loadPackage(wheel);
pyodide.runPython(codeModel);
};
from pyodide-webpack-plugin.
Hi @zloveless, thanks for raising this issue. The documentation could be clearer about this.
The first screenshot you have shows that these files are missing from your local dev server. The examples show basic usage of pyodide and the plugin without any other packages installed. I realize once you start actually adding packages and micropip it gets more complicated.
By default, pyodide (not the plugin) tries to load packages like micropip and other pip packages local to the pyodide.js location. What that means is you would need to download or build micropip and place it at some path available on your dev server, typically /micropip-0.6.0-py3-none-any.whl
or similar by default. The examples show changing that indexURL to keep packages out of the root /
folder and placing them in /pyodide
for organization.
I will note for security this is preferred and is intended behavior. See supply chain security
What you might be interested in for simple testing and verification of the tool is to use the CDN hosted packages that pyodide provides. You can do that by setting the indexURL
in your handleSubmit function to https://cdn.jsdelivr.net/pyodide/v0.26.1/full/
. This should get you running again and will provide the same behavior as if you were serving pyodide from the CDN.
Please let me know if that resolves your issue.
from pyodide-webpack-plugin.
Related Issues (14)
- Supporting arbitrary indexURL HOT 2
- Vue3 Tutorial Project does not build with pyodide-webpack-plugin HOT 3
- Webpack url not found HOT 3
- Option to choose list of files to be copied HOT 12
- Support for Pyodide 0.23.1 HOT 2
- Add support for Vite HOT 1
- PyodidePlugin is not a constructor HOT 3
- Pyodide 0.24.0 rename repodata.json to pyodide-lock.json HOT 3
- `PyodidePlugin is not a constructor` error HOT 13
- Critical dependency: the request of a dependency is an expression HOT 2
- UnhandledSchemeError HOT 3
- Attempted import error: 'version' is not exported from 'pyodide' (imported as 'pyodideVersion'). HOT 4
- NextJS Error. Module not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyodide-webpack-plugin.