PyoDide: Can't find a pure Python 3 wheel for 'pingouin<0.6.0,>=0.5.2'

I am trying to make a Panel app to analyze different biological signals. In order to do that I use the package biopsykit (biopsykit · PyPI). But if I want to convert my app into a standalone web assembly app and open the html file, I get on the screen the error message a ModuleNotFound Error: No Module named ‘biopsykit’. However this package has a py3-none-any.whl as required by Micropip. Also the Browser Console shows the following Error Message:

PythonError: Traceback (most recent call last): File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 234, in __step result = coro.throw(exc) File "/lib/python3.10/site-packages/_pyodide/_base.py", line 506, in eval_code_async await CodeRunner( File "/lib/python3.10/site-packages/_pyodide/_base.py", line 359, in run_async await coroutine File "<exec>", line 3, in <module> File "/lib/python3.10/site-packages/micropip/_micropip.py", line 548, in install await transaction.gather_requirements(requirements) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 305, in gather_requirements await gather(*requirement_promises) File "/lib/python3.10/asyncio/futures.py", line 284, in __await__ yield self # This tells Task to wait for completion. File "/lib/python3.10/asyncio/tasks.py", line 304, in __wakeup future.result() File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 234, in __step result = coro.throw(exc) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 312, in add_requirement return await self.add_requirement_inner(Requirement(req)) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 420, in add_requirement_inner await self.add_wheel(wheel, req.extras) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 435, in add_wheel await self.gather_requirements(wheel.requires(extras)) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 305, in gather_requirements await gather(*requirement_promises) File "/lib/python3.10/asyncio/futures.py", line 284, in __await__ yield self # This tells Task to wait for completion. File "/lib/python3.10/asyncio/tasks.py", line 304, in __wakeup future.result() File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 232, in __step result = coro.send(None) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 309, in add_requirement return await self.add_requirement_inner(req) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 407, in add_requirement_inner wheel = find_wheel(metadata, req) File "/lib/python3.10/site-packages/micropip/_micropip.py", line 275, in find_wheel raise ValueError( ValueError: Can't find a pure Python 3 wheel for 'pingouin<0.6.0,>=0.5.2'. See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel You can use micropip.install(…, keep_going=True)to get a list of all packages with missing wheels.

So Pyodide searches for the pingouin package which is used in the biopsykit package. Can I get this app to run as a standalone webassembly app (e.g. if I build biopsykit myself as well as pingouin)?

Update: non-meaningful response.

Hi @shMeske

If I go to biopsykit · PyPI I don’t see a version pingouin<0.6.0,>=0.5.2. Could you try removing that restriction and just use the latest version?

Hi @Marc

where can I check if that restriction is applied, because in the .py File which I convert the package pingouin is never imported.

I also checked it with a minimum working example, with which I get the same error:

import panel as pn
import biopsykit as bp

from sklearn.datasets import load_iris
from sklearn.metrics import accuracy_score
from xgboost import XGBClassifier

pn.extension(sizing_mode="stretch_width", template="fast")
pn.state.template.param.update(site="Panel in the Browser", title="XGBoost Example")

iris_df = load_iris(as_frame=True)

trees = pn.widgets.IntSlider(start=2, end=30, name="Number of trees")


def pipeline(trees):
    model = XGBClassifier(max_depth=2, n_estimators=trees)
    model.fit(iris_df.data, iris_df.target)
    accuracy = round(
        accuracy_score(iris_df.target, model.predict(iris_df.data)) * 100, 1
    )
    return pn.indicators.Number(
        name="Test score",
        value=accuracy,
        format="{value}%",
        colors=[(97.5, "red"), (99.0, "orange"), (100, "green")],
    )


pn.Column(
    "Simple example of training an XGBoost classification model on the small Iris dataset.",
    iris_df.data.head(),
    "Move the slider below to change the number of training rounds for the XGBoost classifier. The training accuracy score will adjust accordingly.",
    trees,
    pn.bind(pipeline, trees),
).servable()

1 Like

Sorry my mistake above. The problem is that pingouin does not release a wheel file. See pingouin · PyPI

I’ve created a request for a wheel file here Please share wheel file on pypi · Issue #335 · raphaelvallat/pingouin (github.com).

Thank’s a lot for your support @Marc :+1:

I will keep an eye on the GitHub Request :slight_smile:

1 Like

@Marc

I got another question regarding this topic. If I host the .whl Files myself, would it work if I add the Link to this .whl File in the --requirements argument of panel convert?

For example:

panel convert script.py --to pyodide-worker --out pyodide --requirements example-url.com/example-package.whl

I don’t know. But you should be able to quickly try it out.

Hi @shMeske

The pingouin package is now available as a wheel file. Lets us know if it works. And please share your work if you can.