How can I import "autosklearn" using pyodide?

Viewed 67

I want to perform ML in the browser with "autosklearn" via Pyodide. I think Im supposed to load micropip and then use that to load autosklearn from PyPI. But Im getting a CORS error and not sure how Im supposed to go about this. Pyodide and PyPI shouldn't have any CORS restrictions right?

Heres how Im loading the initial packages

pyodide = await loadPyodide({
    indexURL: 'https://cdn.jsdelivr.net/pyodide/v0.18.1/full/',
  });
await pyodide.loadPackage(['scikit-learn', 'micropip']);

Heres the browser code

pyodide.runPython(
    `
      import micropip
      micropip.install('autosklearn')
      import autosklearn.classification
    `,
  );

And here is my error. Notice the CORS error enter image description here

1 Answers

Autosklearn is not compatible with Pyodide. That package requires modules, such as requests, which cannot run in a browser due to browser sandbox security restrictions.

The CORS error in your screenshot is caused by a page not found (404) error.

There is no easy solution for importing auto-sklearn. That package would need to be modified to not use features that do not exist in a browser such as sockets.

Related