-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kable works in RStudio but not JupyterLab w R kernel #10290
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Could you post a screenshot of what you expect to see vs what you actually see? For example, for this Conda environment (see details) name: test-r-kernel
channels:
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=1_gnu
- _r-mutex=1.0.1=anacondar_1
- anyio=3.1.0=py39hf3d152e_0
- argon2-cffi=20.1.0=py39h3811e60_2
- async_generator=1.10=py_0
- attrs=21.2.0=pyhd8ed1ab_0
- babel=2.9.1=pyh44b312d_0
- backcall=0.2.0=pyh9f0ad1d_0
- backports=1.0=py_2
- backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
- binutils_impl_linux-64=2.35.1=h193b22a_2
- binutils_linux-64=2.35=h67ddf6f_30
- bleach=3.3.0=pyh44b312d_0
- brotlipy=0.7.0=py39h3811e60_1001
- bwidget=1.9.14=ha770c72_0
- bzip2=1.0.8=h7f98852_4
- c-ares=1.17.1=h7f98852_1
- ca-certificates=2020.12.5=ha878542_0
- cairo=1.16.0=h6cf1ce9_1008
- certifi=2020.12.5=py39hf3d152e_1
- cffi=1.14.5=py39he32792d_0
- chardet=4.0.0=py39hf3d152e_1
- cryptography=3.4.7=py39hbca0aa6_0
- curl=7.76.1=hea6ffbf_2
- decorator=5.0.9=pyhd8ed1ab_0
- defusedxml=0.7.1=pyhd8ed1ab_0
- entrypoints=0.3=pyhd8ed1ab_1003
- font-ttf-dejavu-sans-mono=2.37=hab24e00_0
- font-ttf-inconsolata=3.000=h77eed37_0
- font-ttf-source-code-pro=2.038=h77eed37_0
- font-ttf-ubuntu=0.83=hab24e00_0
- fontconfig=2.13.1=hba837de_1005
- fonts-conda-ecosystem=1=0
- fonts-conda-forge=1=0
- freetype=2.10.4=h0708190_1
- fribidi=1.0.10=h36c2ea0_0
- gcc_impl_linux-64=9.3.0=h70c0ae5_19
- gcc_linux-64=9.3.0=hf25ea35_30
- gettext=0.19.8.1=h0b5b191_1005
- gfortran_impl_linux-64=9.3.0=hc4a2995_19
- gfortran_linux-64=9.3.0=hdc58fab_30
- graphite2=1.3.13=h58526e2_1001
- gsl=2.6=he838d99_2
- gxx_impl_linux-64=9.3.0=hd87eabc_19
- gxx_linux-64=9.3.0=h3fbe746_30
- harfbuzz=2.8.1=h83ec7ef_0
- icu=68.1=h58526e2_0
- idna=2.10=pyh9f0ad1d_0
- importlib-metadata=4.0.1=py39hf3d152e_0
- ipykernel=5.5.5=py39hef51801_0
- ipython=7.23.1=py39hef51801_0
- ipython_genutils=0.2.0=py_1
- jbig=2.1=h7f98852_2003
- jedi=0.18.0=py39hf3d152e_2
- jinja2=3.0.1=pyhd8ed1ab_0
- jpeg=9d=h36c2ea0_0
- json5=0.9.5=pyh9f0ad1d_0
- jsonschema=3.2.0=pyhd8ed1ab_3
- jupyter_client=6.1.12=pyhd8ed1ab_0
- jupyter_core=4.7.1=py39hf3d152e_0
- jupyter_server=1.8.0=pyhd8ed1ab_0
- jupyterlab=3.0.16=pyhd8ed1ab_0
- jupyterlab_pygments=0.1.2=pyh9f0ad1d_0
- jupyterlab_server=2.5.2=pyhd8ed1ab_0
- kernel-headers_linux-64=2.6.32=h77966d4_13
- krb5=1.19.1=hcc1bbae_0
- ld_impl_linux-64=2.35.1=hea4e1c9_2
- lerc=2.2.1=h9c3ff4c_0
- libarchive=3.5.1=hccf745f_2
- libblas=3.9.0=9_openblas
- libcblas=3.9.0=9_openblas
- libcurl=7.76.1=h2574ce0_2
- libdeflate=1.7=h7f98852_5
- libedit=3.1.20191231=he28a2e2_2
- libev=4.33=h516909a_1
- libffi=3.3=h58526e2_2
- libgcc-devel_linux-64=9.3.0=h7864c58_19
- libgcc-ng=9.3.0=h2828fa1_19
- libgfortran-ng=9.3.0=hff62375_19
- libgfortran5=9.3.0=hff62375_19
- libglib=2.68.2=h3e27bee_0
- libgomp=9.3.0=h2828fa1_19
- libiconv=1.16=h516909a_0
- liblapack=3.9.0=9_openblas
- libmamba=0.13.1=h3a044de_0
- libnghttp2=1.43.0=h812cca2_0
- libopenblas=0.3.15=pthreads_h8fe5266_1
- libpng=1.6.37=h21135ba_2
- libsodium=1.0.18=h36c2ea0_1
- libsolv=0.7.18=h780b84a_0
- libssh2=1.9.0=ha56f1ee_6
- libstdcxx-devel_linux-64=9.3.0=hb016644_19
- libstdcxx-ng=9.3.0=h6de172a_19
- libtiff=4.3.0=hf544144_1
- libuuid=2.32.1=h7f98852_1000
- libwebp-base=1.2.0=h7f98852_2
- libxcb=1.13=h7f98852_1003
- libxml2=2.9.12=h72842e0_0
- lz4-c=1.9.3=h9c3ff4c_0
- lzo=2.10=h516909a_1000
- make=4.3=hd18ef5c_1
- markupsafe=2.0.1=py39h3811e60_0
- matplotlib-inline=0.1.2=pyhd8ed1ab_2
- mistune=0.8.4=py39h3811e60_1003
- nbclassic=0.3.1=pyhd8ed1ab_1
- nbclient=0.5.3=pyhd8ed1ab_0
- nbconvert=6.0.7=py39hf3d152e_3
- nbformat=5.1.3=pyhd8ed1ab_0
- ncurses=6.2=h58526e2_4
- nest-asyncio=1.5.1=pyhd8ed1ab_0
- notebook=6.4.0=pyha770c72_0
- openssl=1.1.1k=h7f98852_0
- packaging=20.9=pyh44b312d_0
- pandoc=2.13=h7f98852_0
- pandocfilters=1.4.2=py_1
- pango=1.48.5=hb8ff022_0
- parso=0.8.2=pyhd8ed1ab_0
- pcre=8.44=he1b5a44_0
- pcre2=10.36=h032f7d1_1
- pexpect=4.8.0=pyh9f0ad1d_2
- pickleshare=0.7.5=py_1003
- pip=21.1.2=pyhd8ed1ab_0
- pixman=0.40.0=h36c2ea0_0
- prometheus_client=0.10.1=pyhd8ed1ab_0
- prompt-toolkit=3.0.18=pyha770c72_0
- pthread-stubs=0.4=h36c2ea0_1001
- ptyprocess=0.7.0=pyhd3deb0d_0
- pycparser=2.20=pyh9f0ad1d_2
- pygments=2.9.0=pyhd8ed1ab_0
- pyopenssl=20.0.1=pyhd8ed1ab_0
- pyparsing=2.4.7=pyh9f0ad1d_0
- pyrsistent=0.17.3=py39h3811e60_2
- pysocks=1.7.1=py39hf3d152e_3
- python=3.9.4=hffdb5ce_0_cpython
- python-dateutil=2.8.1=py_0
- python_abi=3.9=1_cp39
- pytz=2021.1=pyhd8ed1ab_0
- pyzmq=22.0.3=py39h37b5a0c_1
- r-askpass=1.1=r40hcfec24a_2
- r-assertthat=0.2.1=r40hc72bb7e_2
- r-base=4.0.5=h9e01966_1
- r-base64enc=0.1_3=r40hcfec24a_1004
- r-callr=3.7.0=r40hc72bb7e_0
- r-cli=2.5.0=r40hc72bb7e_0
- r-colorspace=2.0_1=r40hcfec24a_0
- r-cpp11=0.2.7=r40hc72bb7e_0
- r-crayon=1.4.1=r40hc72bb7e_0
- r-curl=4.3.1=r40hcfec24a_0
- r-digest=0.6.27=r40h03ef668_0
- r-ellipsis=0.3.2=r40hcfec24a_0
- r-evaluate=0.14=r40hc72bb7e_2
- r-fansi=0.5.0=r40hcfec24a_0
- r-farver=2.1.0=r40h03ef668_0
- r-gdtools=0.2.2=r40h36050f4_1
- r-glue=1.4.2=r40hcfec24a_0
- r-highr=0.9=r40hc72bb7e_0
- r-htmltools=0.5.1.1=r40h03ef668_0
- r-httr=1.4.2=r40hc72bb7e_0
- r-irdisplay=1.0=r40hd8ed1ab_0
- r-irkernel=1.2=r40hc72bb7e_0
- r-jsonlite=1.7.2=r40hcfec24a_0
- r-kableextra=1.3.4=r40hc72bb7e_0
- r-knitr=1.33=r40hc72bb7e_0
- r-labeling=0.4.2=r40hc72bb7e_0
- r-lifecycle=1.0.0=r40hc72bb7e_0
- r-magrittr=2.0.1=r40hcfec24a_1
- r-markdown=1.1=r40hcfec24a_1
- r-mime=0.10=r40hcfec24a_0
- r-munsell=0.5.0=r40hc72bb7e_1003
- r-openssl=1.4.4=r40he36bf35_0
- r-pbdzmq=0.3_5=r40h42bf92c_1
- r-pillar=1.6.1=r40hc72bb7e_0
- r-pkgconfig=2.0.3=r40hc72bb7e_1
- r-processx=3.5.2=r40hcfec24a_0
- r-ps=1.6.0=r40hcfec24a_0
- r-r6=2.5.0=r40hc72bb7e_0
- r-rcolorbrewer=1.1_2=r40h785f33e_1003
- r-rcpp=1.0.6=r40h03ef668_0
- r-repr=1.1.3=r40h785f33e_0
- r-rlang=0.4.11=r40hcfec24a_0
- r-rmarkdown=2.8=r40hc72bb7e_0
- r-rstudioapi=0.13=r40hc72bb7e_0
- r-rvest=1.0.0=r40hc72bb7e_0
- r-scales=1.1.1=r40hc72bb7e_0
- r-selectr=0.4_2=r40hc72bb7e_1
- r-stringi=1.6.2=r40hcabe038_0
- r-stringr=1.4.0=r40hc72bb7e_2
- r-svglite=2.0.0=r40h03ef668_0
- r-sys=3.4=r40hcfec24a_0
- r-systemfonts=1.0.2=r40hef9c87a_0
- r-tibble=3.1.2=r40hcfec24a_0
- r-tinytex=0.31=r40hc72bb7e_0
- r-utf8=1.2.1=r40hcfec24a_0
- r-uuid=0.1_4=r40hcfec24a_1
- r-vctrs=0.3.8=r40hcfec24a_1
- r-viridislite=0.4.0=r40hc72bb7e_0
- r-webshot=0.5.2=r40hc72bb7e_1
- r-xfun=0.23=r40hcfec24a_0
- r-xml2=1.3.2=r40h03ef668_1
- r-yaml=2.2.1=r40hcfec24a_1
- readline=8.1=h46c0cb4_0
- reproc=14.2.1=h36c2ea0_0
- reproc-cpp=14.2.1=h58526e2_0
- requests=2.25.1=pyhd3deb0d_0
- rhumba=0.1.1=r40h9c3ff4c_4
- sed=4.8=he412f7d_0
- send2trash=1.5.0=py_0
- setuptools=49.6.0=py39hf3d152e_3
- six=1.16.0=pyh6c4a22f_0
- sniffio=1.2.0=py39hf3d152e_1
- sqlite=3.35.5=h74cdb3f_0
- sysroot_linux-64=2.12=h77966d4_13
- terminado=0.10.0=py39hf3d152e_0
- testpath=0.5.0=pyhd8ed1ab_0
- tk=8.6.10=h21135ba_1
- tktable=2.10=hb7b940f_3
- tornado=6.1=py39h3811e60_1
- traitlets=5.0.5=py_0
- tzdata=2021a=he74cb21_0
- urllib3=1.26.4=pyhd8ed1ab_0
- wcwidth=0.2.5=pyh9f0ad1d_2
- webencodings=0.5.1=py_1
- websocket-client=0.57.0=py39hf3d152e_4
- wheel=0.36.2=pyhd3deb0d_0
- xorg-kbproto=1.0.7=h7f98852_1002
- xorg-libice=1.0.10=h7f98852_0
- xorg-libsm=1.2.3=hd9c2040_1000
- xorg-libx11=1.7.1=h7f98852_0
- xorg-libxau=1.0.9=h7f98852_0
- xorg-libxdmcp=1.1.3=h7f98852_0
- xorg-libxext=1.3.4=h7f98852_1
- xorg-libxrender=0.9.10=h7f98852_1003
- xorg-libxt=1.2.1=h7f98852_2
- xorg-renderproto=0.11.1=h7f98852_1002
- xorg-xextproto=7.3.0=h7f98852_1002
- xorg-xproto=7.0.31=h7f98852_1007
- xz=5.2.5=h516909a_1
- yaml-cpp=0.6.3=he1b5a44_4
- zeromq=4.3.4=h9c3ff4c_0
- zipp=3.4.1=pyhd8ed1ab_0
- zlib=1.2.11=h516909a_1010
- zstd=1.5.0=ha95c52a_0 |
Ah, drat - I didn't read your post properly! Thanks for the clarification. I don't have time to look at this right now, but I have some thoughts. Although I'm not an R user, it's clear that the rich display mechanism works for the original table. This leads me to suspect that it's something about the |
Thanks Angus. I've cross-posted this over on the KableExtras issues page (haozhu233/kableExtra#620 (comment)). |
@sjgenco RE the |
Here the list of packages currently in my conda virtual env, r_env. Environment:
|
@sjgenco the code that raises that error is relatively simple; it calls
and
|
Hmm. Good to learn you've found the source, but the reason for the
I wonder if this might be relevant. I looked up
But when I do Then I tried this:
At first it appears in the path, as expected, but then it disappears again when I restart the kernel. My guess is this has something to do with this python path. Will dig some more. |
|
Well, it's not there ...
but this "PATH" is different from
Arghh ... path, PATH, PYTHONPATH ... there are too many paths in this forest |
Here's another interesting discrepancy that may be relevant. As we all know, the 'export to PDF' command doesn't work inside JupyterLab, but it does work at the command line with something like I also sent this issue to the kableExtra folks on github and they suggested a workaround which I tried out in a fresh JupyterLab Notebook. The workaround worked in that it produced a nicely formatted inline table. Just now, I ran the command-line But the pdf conversion just skipped over that output. I don't believe the html export invokes latex. It's clear from the formatting that the pdf export does. So this shows all the basic machinery for converting jupyterlab notebooks is present. But whatever is keeping JupyterLab from outputing kable-formatted text inline, it's also causing it to fail to print it as part of a full document export. BTW: that workaround is described here: https://stackoverflow.com/questions/46531571/how-do-i-format-an-r-table-in-an-r-jupyter-notebook/46532394#46532394 |
Description
I'm trying to generate nice-looking tables in JupyterLab using
library(kableExtra)
All the simple examples from the
knitr::kable
site work fine in RStudio but only produce xml output in JupyterLab.I haven't found anything here in 'Issues' or elsewhere on the web that hints at a solution.
Surprising to me, since this seems pretty fundamental.
Reproduce
Here's the simple R code example from the Kable site
this works as expected in both RStudio & JupyterLab
now try this simple kable_styling command
In RStudio, I get a nicely formatted table in the 'Viewer' pane. Other kable options and styles also work as expected.
In JupyterLab I get this:
... and so on
Expected behavior
I expected the table to format properly in JupyterLab, like in RStudio
Context
I've read that this problem may relate to the problem with trying to export a JupyterLab notebook to PDF.
I had that problem too. Read a lot about
pandoc
andnbconvert
andxelatex
and gettingxelatex
into the$PATH
.Just want to note that I have installed latest versions of MacTex and all those pkgs, and xelatex IS in my PATH:
By the way, the 'Export Notebook as ... PDF' still doesn't work inside JupyterLab, giving the familiar (and apparently incorrect) error:
nbconvert failed: xelatex not found on PATH, if you have not installed xelatex you may need to do so.
But I can get that export to work when I run it from the command line in terminal:
jupyter nbconvert --to PDF notebook.ipynb
which is another indication that all the pieces are in place, JupyterLab is simply not doing the expected conversions.
Thanks for any ideas you might have!
The text was updated successfully, but these errors were encountered: