As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [pyodide]

Please prefer using tags for the contained packages with questions which are more specifically related to them. Pyodide brings the Python 3.8 runtime to the browser via WebAssembly, along with the Python scientific stack including NumPy, Pandas, Matplotlib, parts of SciPy, and NetworkX.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

Pyodide - UI input instead of prompt

I am trying to run a python programming with pyodide, where the program has x =input(). This will ask the user input in prompt. Now I need to show the input in UI(DOM) await for input before executing ...
Jothi Kannan's user avatar
  • 3,292
0 votes
1 answer
35 views

How can I run python files that I wrote into Pyodides file system?

I am writing a Pyodide based text editor that will run test scripts, when a user types into the editor, using ace-editor, I grab whatever the user types and write it into a python file using pyodides ...
Cr3 D's user avatar
  • 143
1 vote
1 answer
20 views

Why is Pyodide giving me a 'File is not a zip file' error when I try to install a .whl package using micropip?

I'm trying to import a .whl package using micropip into pyodide for use in an html file, but am getting an error about "must be a zip file"? Based on the documentation of micropip here, I ...
teles's user avatar
  • 11
0 votes
1 answer
20 views

How to load my own custom python packages into Pyodide using javascript?

//fileSaver is used to save the code to a file and download it const fileSaver = require('file-saver'); // Setup ace variables and the output pane for pyodide var editor = ace.edit("editor")...
Cr3 D's user avatar
  • 143
2 votes
1 answer
45 views

Is there a way to change the html textContent from inside the pyodide runPython function?

So for example I have a for loop inside my pyodide script that is inside my .html document. Is there a ways to change textContent of a div directly from pyodide for loop. In the example below, only ...
LuxGOD's user avatar
  • 33
1 vote
2 answers
65 views

Jupyterlite: accessing functions and libraries in a separate file?

I have a JupyterLite/pyodide session running a nodebook called "Workshop1.ipynb`. In the same (root) directory as that notebook, I have a file containing useful functions which also does some ...
user2667066's user avatar
  • 1,827
1 vote
1 answer
19 views

How do you reset a file in Jupyterlite to the original version

Jupyterlite is greate with pyodide in the background but I was stuck trying to reset the files to those that were in the distribution. How do you reset a file?
hum3's user avatar
  • 1,533
0 votes
1 answer
146 views

Import boto3 into my project built with pyodide (unhelpful errors)

I've tried a number of things trying to import boto3 into a project I'm contributing to (thats built with pyodide)but keep receiving unhelpful errors. Is this a syntax issue or something more? This is ...
Stan's user avatar
  • 1
0 votes
1 answer
66 views

How can I make loadPyodide() available to any component?

Using Vue with Pinia, is it possible to load loadPyodide() into Pinia and assign it to a variable, so that components can use runPython()? For example, in Pinia, I have this code where I am assigning ...
rafaelcb21's user avatar
  • 12.2k
0 votes
1 answer
66 views

How to import the 'PyPDF4' library in Pyodide?

"I'm trying to import the 'PyPDF4' library in Pyodide using micropip but it's giving me an error: ValueError: Can't find a pure Python 3 wheel for 'pypdf4'. Would anyone know what I'm doing ...
rafaelcb21's user avatar
  • 12.2k
0 votes
0 answers
25 views

Pyodide: runPythonAsync exceptions show asyncio stacktrace instead of inner one

When running python using runPythonAsync, and there is an exception i get the stacktrace of asyncio call, instead of the original code stacktrace. How do I get access to the internal stacktrace ...
Cesar's user avatar
  • 4,418
4 votes
2 answers
243 views

Read a file line by line in Pyodide

The code below reads the user-selected input file entirely. This requires a lot of memory for very large (> 10 GB) files. I need to read a file line by line. How can I read a file in Pyodide one ...
Timur Shtatland's user avatar
0 votes
1 answer
63 views

Pass dropdown menu selection to Pyodide

I am trying to pass the value selected by the user from the dropdown menu to the Python code in Pyodide. In the simplified example below, I am trying to: Read the user-selected input file Convert ...
Timur Shtatland's user avatar
0 votes
1 answer
158 views

Executing Python via newer versions of Pyodide in React leads to an error

I am a React and Pyodide newbie. I am trying to get the following code to work in a way that I can utilize some OpenCV functionality. The code below works and I can use numpy, etc in the calculations. ...
GaryK's user avatar
  • 123
1 vote
3 answers
302 views

Select and read a file from user's filesystem

I need to: Enable the user to select a plain text file from the user's filesystem. Make it available to Pyodide. Read its contents line-by-line in Pyodide (in the Python code). The code to read ...
Timur Shtatland's user avatar
0 votes
0 answers
35 views

Is it possible to test Pyodide in Angular using Karma/Jasmine?

I am trying to write unit tests for an Angular web application. Please note I am very, very new to web development. One of the Services, ProcessorService uses pyodide to run python code. I want to ...
AlexM's user avatar
  • 1
0 votes
3 answers
117 views

Plotting an Image from GitHub using pyscript and matplotlib

Using pyscript it's easy to load in raw data from GitHub, like in the intro tutorial where you read in a Pandas DataFrame like so: url = ( "https://raw.githubusercontent.com/Cheukting/...
Justin Essert's user avatar
1 vote
1 answer
144 views

PyScript API fetch: "NetworkError when attempting to fetch resource" Error with pyfetch/pyodide.http

I receive this error: "JsException: TypeError: NetworkError when attempting to fetch resource" when opening my html file that renders py-script code. I have visited the numerous other posts ...
Colter's user avatar
  • 11
0 votes
1 answer
66 views

How would I import z3 solver in pyodide

I am trying to recreate a python project that uses z3 solver, which is not very supported on JS (especially on html) I found that I could use pyodide for doing python code and make this project a lot ...
ThatTheredstoner's user avatar
0 votes
0 answers
51 views

Data validation fails when send to pyodide

The problem is the code is working but it does not verify. The sample below was the first iteration of the implementation of the code. below. That code operates accurately, but once I save the ...
Mr.Deadpool's user avatar
2 votes
1 answer
250 views

How to read an excel file from a local directory using <py-script>

Requirement : I want to read a excel file from my local directory by using <py-script> Problem Statement : py-script runs under their own environment. Hence, It is not able to locate the current ...
Rohìt Jíndal's user avatar
1 vote
1 answer
110 views

Memory limits in Pyodide

What is the current limit on memory in Pyodide, and how do I maximize it? For example, does it depend on the client browser, or does it default to the RAM of the client machine? Related old question: ...
Timur Shtatland's user avatar
0 votes
2 answers
207 views

How to render a python panel component from react with pyodide?

I am trying to use an example from the panel documentation of how to display a panel component from python using pyodide, but from a react component, instead of from pure html. I have set up a minimal ...
SomeRandomPhysicist's user avatar
1 vote
1 answer
246 views

My function does not execute when using await in a async function pyscript

I try to fetch data from my api in python using pyscript. Following the pyscript documentation I use the async keyword on my main function and use asyncio.ensure_future to execute it, everything ...
Samuel Diop's user avatar
0 votes
1 answer
61 views

pyscript error with WordPress integration

Hi Goodies i have an issue in pyscript issue : when i paste the below pyscript code in my WordPress post as an html and press preview it just simply popups to dawnload the pyodide file instead of ...
AMEER SAID's user avatar
0 votes
0 answers
49 views

Pyodide with numba compiled .so library

I have a python library which has a numba AOT compile function into a .so file. I am trying to bundle this into a pyodide wheel. When I examine the wheel file, the .so file (or webasm version) is ...
Seraj Ahmad's user avatar
-2 votes
1 answer
99 views

Error installing Pyodide and not finding the module 'piplite' [closed]

The image reference is given, one can have a look, and please guide me if you can... Also, can anyone please tell me why 'piplite' is not being installed on my windows PC. It always throws an error ...
Laxmi Narayan's user avatar
1 vote
0 answers
94 views

Cannot install openai with micropip

Unable to install openAI in Pyodide I run the following but get the error: Couldn't find a pure Python 3 wheel for 'openai' import micropip await micropip.install('openai')
cadasa's user avatar
  • 11
0 votes
0 answers
31 views

Calling Scipy special functions from Pyodide in Node.js

I have Node v18.13.0, I have run npm install -D "pyodide@>=0.21.0-alpha.2", and am running the following code (put it in a file called test.js and run node test.js): var {loadPyodide} = ...
Ahmed Fasih's user avatar
  • 6,402
0 votes
1 answer
185 views

PyScript (Pyodide + WASM + ...) in the browser connects to the SQL server through SQL driver failed

the same .py script run itself works successfully, but in html get error environment: open the live server on visual studio code to run .html <html> <head> <link rel="...
暫時時's user avatar
0 votes
1 answer
74 views

PyScript: How to pass in authorization token to API and return contents?

I'm creating a website on a static server (Github Pages) and am trying to call the Spotify API to obtain my most recently played track. I think the issue I'm having is that I'm having trouble entering ...
needhelppls93024's user avatar
0 votes
1 answer
40 views

python imprt own function in html page

knowing that with <py-config> and <py-script> can execute python code in html However, importing own function facing error (PY1001): Unable to install package(s) 'bread'. Reason: Can't ...
joy.socl's user avatar
0 votes
1 answer
105 views

Can html with pyscript run python files without freezing everything on the webpage?

I am using pyscript to do image processing for a website I am making on hamming and reed solomon codes. It does however take a long time to load. I have a css loading animation but it freezes while ...
Liam's user avatar
  • 3
0 votes
0 answers
126 views

Dyodide: How do you handle stdin correctly?

I'm new to pyodide, I decided to try to use it for an open-source educational software: https://talco-team.github.io/TALightDesktop (live demo) For the time being I've done my best following the ...
Cesar's user avatar
  • 4,418
1 vote
1 answer
85 views

How to run `python -m <module>`?

How can I run python -m black (or pass Python code as input to main function of black to get formatted output) in Pyodide? Pyodide demo I'm hoping to add a "Format" button to the bottom ...
fejyesynb's user avatar
  • 172
2 votes
1 answer
39 views

Manually trace function in Pyodide without locking main thread

I am trying to build a browser-based debugging tool for Python but I am having trouble combining the Python inner workings with user interactions. My setup looks like this (jsfiddle link). Essentially ...
Blupper's user avatar
  • 378
1 vote
1 answer
41 views

how to get active REPL block in PyScript and copy whatever code written in it?

I have multiple code blocks in pyscript repl which were created dynamically on button click. I want to know which code block is active. I know library adds cm-activeLine class when line is active but ...
Jamshaid Tariq's user avatar
1 vote
1 answer
1k views

Why do I get the error: No module named 'pyodide'

I installed pyodide.http but I cannot import it. What did I do wrong? C:\Users\malik>pip install pyodide.http Requirement already satisfied: pyodide.http in c:\users\malik\appdata\local\programs\...
modernAlchemist's user avatar
1 vote
2 answers
641 views

Unable to import a python package in Pyodide

I am trying to import a custom package in Pyodide but it is not working. The directory structure is index.html package/ __init__.py And my index.html looks like this <!DOCTYPE html> <...
Sanskar Jethi's user avatar
0 votes
0 answers
33 views

Pyscript run all code blocks on one click

I want to run all code blocks on one click. Pyscript does have a run button on all of the <py-repl /> but I want to run all of blocks on single click and show output as one. Further I want to ...
Jamshaid Tariq's user avatar
0 votes
0 answers
188 views

Pyscript: upload txt file make lowercase then download

I am trying to make a simple example of a pyscript/html file that does the following. Select a txt file Click convert button. This uploads the file The contents of the file is made all lowercase The ...
Vincent's user avatar
  • 1,549
0 votes
1 answer
293 views

How can I run my python file on the web via pyodide

I have written a python code with which I can get the bluetooth data of the surrounding Devices. I need to run this code on the browser and it should be able to see the data of the surrounding ibeacon ...
profundusman's user avatar
0 votes
0 answers
53 views

Set JS sessionStorage item within PyScript

I am trying to set a Javascript local variable within a PyScript script (directly in Python): from js import sessionStorage from js import window from js import alert from pyodide import create_proxy, ...
user3535901's user avatar
  • 3,508
0 votes
1 answer
294 views

How to suppress Pyodide Warning in PyScript?

I have the following PyScript + HTML example and I get the following error: /lib/python3.10/site-packages/pyodide/__init__.py:74: FutureWarning: pyodide.create_proxy has been moved to pyodide.ffi....
pliroforiki's user avatar
3 votes
1 answer
171 views

Switch/Change the version of Python in pyscript

I am just started looking/experimenting pyscript as per the current python code which is running on Python 3.6.0. But looks like pyscript loads the python version along with Pyodide and it is retuning ...
Rohìt Jíndal's user avatar
1 vote
0 answers
22 views

How to pass an object from React (GatsbyJS) to PyScript [duplicate]

I've created a form in GatsbyJS, and I'd like the data from that form to be passed into an external PyScript file, where it processes the data and returns a value. I've found tutorials that suggest ...
Darren Dube's user avatar
0 votes
0 answers
82 views

How to use pyo-js-turtle in Pyodide

My initial target is add turtle module in pyodide. I looked up the document of pyodide and found that it could be loaded by Micropip. So I found pyo-js-turtle. But when I import it, it turns out that ...
interlink's user avatar
0 votes
0 answers
411 views

PyScript + Pyodide + MySQL DB connection = WebSockets problem, can't connect to my DB

I'm trying to figure out why I can't connect to the MySQL database from JavaScript/PyScript project. Here's my index.html: <!DOCTYPE html> <html lang="en"> <head> <...
krafteuer31's user avatar
0 votes
0 answers
239 views

How to install pyodide package on vs code

I want to use the pyodide package on a data analysis project on vs code but i can't install this packcage , I need help please I tried to run pip install pyodide but i have this problem : Collecting ...
MOHAMMED MOUAADH DJAWED BAGHDA's user avatar
1 vote
1 answer
597 views

How to get Pyodide to work in a React component?

I am trying to make my own Python fundamentals tutorial that's similar to the interactive editor that codecademy.com has. However, I'm struggling to make Pyodide work with React. Using the very basic ...
chillingfox's user avatar