dask-sql icon indicating copy to clipboard operation
dask-sql copied to clipboard

[BUG] c.ipython_magic doesn't work in recent Jupyter Lab

Open randerzander opened this issue 4 years ago • 3 comments

With a clean conda environment:

conda create --name test python=3.8
conda activate test
conda install -c conda-forge dask-sql jupyterlab

From a clean notebook:

from dask_sql import Context

c = Context()
c.ipython_magic()
Javascript Error: require is not defined

It wasn't clear from the docs if c.ipython_magic() is meant to be called as a standalone statement, or with some other SQL statement in the same cell: cell 1:

import pandas as pd

pdf = pd.DataFrame({'id': [0, 1]})
c.create_table('pdf', pdf)

cell 2:

c.ipython_magic()

%%sql
select * from pdf
  File "/tmp/ipykernel_1052382/1033121043.py", line 4
    select * from pdf
             ^
SyntaxError: invalid syntax

Conda environment details:

(test) rgelhausen@rl-dgx2-r13-u7-rapids-dgx201:~/shared/gpu-bdb/gpu_bdb/cluster_configuration$ conda list | grep dask
dask                      2021.10.0          pyhd8ed1ab_0    conda-forge
dask-core                 2021.10.0          pyhd8ed1ab_0    conda-forge
dask-sql                  0.3.9              pyhd8ed1ab_0    conda-forge
(test) rgelhausen@rl-dgx2-r13-u7-rapids-dgx201:~/shared/gpu-bdb/gpu_bdb/cluster_configuration$ conda list | grep jup
jupyter_client            7.0.6              pyhd8ed1ab_0    conda-forge
jupyter_core              4.8.1            py38h578d9bd_0    conda-forge
jupyter_server            1.11.1             pyhd8ed1ab_0    conda-forge
jupyterlab                3.2.1              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_server         2.8.2              pyhd8ed1ab_0    conda-forge

randerzander avatar Oct 25 '21 18:10 randerzander

I am able to reproduce the same error with Jupyter Lab, but c.ipython_magic() already works with a regular Jupyter Notebook.

One user from Stack Overflow suggested doing Help -> Launch Classic Notebook if the user is working out of Jupyter Lab.

Should I start working on a Jupyter Labs solution as well, or is Jupyter Notebooks enough?

sarahyurick avatar Sep 19 '22 20:09 sarahyurick

JupyterLab is quite commonly used these days.

Ideally we'd have a single implementation that supports both JupyterLab and Jupyter Notebook users.

I may be wrong, but I believe it's the syntax highlighting part of the current implementation that depends on Jupyter Notebook.

If we removed syntax highlighting, or otherwise detected JupyterLab and disabled syntax highlighting, would that allow Dask-SQL's sql magic to work in JupyterLab?

randerzander avatar Sep 19 '22 21:09 randerzander

Can be closed since #772 was merged.

sarahyurick avatar Dec 16 '22 20:12 sarahyurick