jupyterlite / xeus-python-kernel

xeus-python in JupyterLite
https://xeus-python-kernel.readthedocs.io
BSD 3-Clause "New" or "Revised" License
30 stars 19 forks source link

`import pandas` hangs with jupyterlite-xeus-python 0.5.4 and jupyterlite 0.1.0b12 #67

Closed vasiljevic closed 2 years ago

vasiljevic commented 2 years ago

Description

Execusion of cell import pandas hangs. This exception message is shown on the JavaScript Console:

Uncaught (in promise) SyntaxError: Unexpected end of input (at services.js:32:51) at services.js:32:51 at new Promise () at services.js:28:7

Reproduce

  1. have installed jupyterlite 0.1.0b12 and jupyterlite-xeus-python 0.5.4
  2. init new site and build it width jupyter lite build --XeusPythonEnv.packages=openpyxl,pandas,matplotlib
  3. Open site in the browser
  4. Create new notebook and select Xeus-python kernel
  5. Add cell with import pandas and run it
  6. Go to JavaScript console and see an exeption like this: Uncaught (in promise) SyntaxError: Unexpected end of input (at services.js:32:51) ...

Expected behavior

Pandas should be normally imported in several seconds

Context

Browser Output
Uncaught (in promise) SyntaxError: Unexpected end of input (at services.js:32:51)
    at services.js:32:51
    at new Promise ()
    at services.js:28:7
jtpio commented 2 years ago

Thanks @vasiljevic for reporting.

0.1.0b12 was just released which includes some changes that might be related such as https://github.com/jupyterlite/jupyterlite/pull/753.

Importing pandas seems to be working fine with the Pyodide kernel. So it might be that jupyterlite-xeus-python needs to adapt to these upstream changes.

image

martinRenou commented 2 years ago

Thanks! I'll have a look

vasiljevic commented 2 years ago

Importing pandas seems to be working fine with the Pyodide kernel.

I know, but in Pyodide kernel I can't easily build environment with preinstalled packages like openpyxl (without the need to put piplite.install/micropip.install in my notebook)

jtpio commented 2 years ago

I know, but in Pyodide kernel I can't easily build environment with preinstalled packages like openpyxl (without the need to put piplite.install/micropip.install in my notebook)

Sure, it was just to double check whether this was an issue in JupyterLite or in jupyterlite-xeus-kernel.

martinRenou commented 2 years ago

I was wondering if it could also be due to latest empack release, but that doesn't seem to be the case.

It's really when updating to jupyterlite 0.1.0b12 that it breaks. I'm investigating.

martinRenou commented 2 years ago

I guess this code needs updating https://github.com/jupyterlite/xeus-python-kernel/blob/main/src/worker.ts#L21 now with the latest jupyterlite.

This piece of code is a weird corner case that xeus-python is having with the DriveFS that I don't understand. It should probably not be in xeus-python-kernel though, I should probably make a PR to jupyterlite.

martinRenou commented 2 years ago

import pandas seems to work again with jupyterlite-xeus-python 0.5.5. Thanks a lot for reporting!!

vasiljevic commented 2 years ago

import pandas seems to work again with jupyterlite-xeus-python 0.5.5. Thanks a lot for reporting!!

Works in my project too :) Thank You!