pyodide / micropip

A lightweight Python package installer for Pyodide
https://micropip.pyodide.org
Mozilla Public License 2.0
68 stars 16 forks source link

micropip.install hangs due to network issues in workers #76

Closed bugzpodder closed 9 months ago

bugzpodder commented 10 months ago

I am encountering an issue where micropip.install hangs due to various reasons, eg this fetchingjson:

This is done in a worker thread I believe and never happens on the main-thread. The result is that:

await micropip.install never returns...

Screenshot 2023-08-10 at 5 57 28 PM

one of the request is from

https://pypi.org/pypi/seaborn/json
ryanking13 commented 10 months ago

Thanks for the report @bugzpodder. Maybe adding a timeout parameter to micropip.install would help with what you're experiencing?

bugzpodder commented 10 months ago

I am not sure what the core issue was but I did some changes so that I only started installing packages from micropip when the worker has bootstraped pyodide completely, and tried to isolate the worker to running to one piece of python code at a time and I think its working now?

The strange thing is that it does seem to be browser request that never comes back and it only happens in workers.

bugzpodder commented 10 months ago

Actually going to reopen this. micropip.install doesn't always hang at the fetch. For example in my console this is the last line:

Loading pandas, numpy, python-dateutil, six, pytz

where it gets stuck and await never returns. so if timeout actually works on the entire function it's probably a good idea. I might be able to use Promise.race in js land in the meantime.

bugzpodder commented 9 months ago

Haven't seen this issue in a long time.