Closed Jean-Baptiste-Lasselle closed 8 months ago
After R kernel works, I want to add an example of using Polars with R language:
https://github.com/pola-rs/r-polars
I'll just do the exact same notebook, in typescript, and R language (perhaps later in python the others interested in python could do it
jbl@pokus2:~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash -c 'source ~/.bashrc && conda --version' conda 24.1.2
jbl@pokus2:~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash -c 'source ~/.bashrc && Rscript --version'
R scripting front-end version 3.5.0 (2018-04-23)
jbl@pokus2:~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash -c 'source ~/.bashrc && R --version'
R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.
Oh how to install ikernel but with the github repo instructions, to register the kernel to jupyter :
jbl@pokus2:~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash
pwd
/usr/dataviz/notebooks/decoderleco
bash
ls -alh
total 32K
drwxr-xr-x 7 1000 1000 4.0K Mar 9 16:54 .
drwxr-xr-x 3 root root 4.0K Mar 5 21:20 ..
drwx------ 4 root root 4.0K Mar 8 22:27 .Trash-0
drwxr-xr-x 2 root root 4.0K Mar 8 22:27 .ipynb_checkpoints
drwxr-xr-x 3 1000 1000 4.0K Mar 5 21:15 data
drwxr-xr-x 3 1000 1000 4.0K Mar 8 11:50 first-examples
-rw-r--r-- 1 root root 70 Mar 9 16:55 install.ikernel.r
drwxr-xr-x 3 1000 1000 4.0K Mar 9 15:56 jb
cat install.ikernel.r
install.packages(IRkernel)
IRkernel --version
IRkernel::installspec()
echo "install.packages('IRkernel')" | tee -a ./install.ikernel.r
install.packages('IRkernel')
cat install.ikernel.r
install.packages(IRkernel)
IRkernel --version
IRkernel::installspec()
install.packages('IRkernel')
echo "install.packages('IRkernel')" | tee ./install.ikernel.r
install.packages('IRkernel')
cat install.ikernel.r
install.packages('IRkernel')
echo "IRkernel::installspec()" | tee -a ./install.ikernel.r
IRkernel::installspec()
cat install.ikernel.r
install.packages('IRkernel')
IRkernel::installspec()
Rscript ./install.ikernel.r
bash: line 12: Rscript: command not found
Rscript --version
bash: line 13: Rscript: command not found
exit
exit
jbl@pokus2:~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash -c 'source ~/.bashrc && Rscript ./install.ikernel.r'
Error in contrib.url(repos, type) :
trying to use CRAN without setting a mirror
Calls: install.packages -> grep -> contrib.url
Execution halted
jbl@pokus2:~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash
cat ./install.ikernel.r
install.packages('IRkernel')
IRkernel::installspec()
echo 'options(repos = c(CRAN = "https://cloud.r-project.org"))' > ~/.Rprofile
exit
jbl@pokus2:~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash -c 'source ~/.bashrc && Rscript ./install.ikernel.r'
trying URL 'https://cloud.r-project.org/src/contrib/IRkernel_1.3.2.tar.gz'
Content type 'application/x-gzip' length 45172 bytes (44 KB)
==================================================
downloaded 44 KB
* installing *source* package ‘IRkernel’ ...
** package ‘IRkernel’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
code for methods in class “CommManager” was not checked for suspicious field assignments (recommended package ‘codetools’ not available?)
code for methods in class “Comm” was not checked for suspicious field assignments (recommended package ‘codetools’ not available?)
code for methods in class “Executor” was not checked for suspicious field assignments (recommended package ‘codetools’ not available?)
code for methods in class “Kernel” was not checked for suspicious field assignments (recommended package ‘codetools’ not available?)
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (IRkernel)
The downloaded source packages are in
‘/tmp/Rtmpd8UdHc/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
jbl@pokus2:~/poc-data-visualization$
yeahhhhhhhhh :D :
ok we have the feature of R language support, plus some good sweeties, only left to do :
Here is the issue I got :
jupyter_deno_1 | Error in dev.control(displaylist = "enable") :
jupyter_deno_1 | dev.control() called without an open graphics device
jupyter_deno_1 | Calls: <Anonymous> ... tryCatch -> tryCatchList -> evaluate -> dev.control
jupyter_deno_1 | In addition: Warning messages:
jupyter_deno_1 | 1: In ok_device(filename, ...) :
jupyter_deno_1 | unable to load shared object '/root/anaconda3/lib/R/library/grDevices/libs//cairo.so':
jupyter_deno_1 | libXrender.so.1: cannot open shared object file: No such file or directory
jupyter_deno_1 | 2: In ok_device(filename, ...) : failed to load cairo DLL
jupyter_deno_1 | Execution halted
Sources of infos I found while googling that:
conda
which led me to many jupyter issues :
X11
related errors, jupyter/datascience-notebook
docker imageconda
, the libxrender1
one. Ok, i read a bit the issues comment I and soon found that lots of libraries were installed, in the official jupyter nootebooks docker container image for r-notebook
(some apt-get
installed, and some conda
installed):
# R pre-requisites
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
fonts-dejavu \
unixodbc \
unixodbc-dev \
r-cran-rodbc \
gfortran \
gcc && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN mamba install --yes \
'r-base' \
'r-caret' \
'r-crayon' \
'r-devtools' \
'r-e1071' \
'r-forecast' \
'r-hexbin' \
'r-htmltools' \
'r-htmlwidgets' \
'r-irkernel' \
'r-nycflights13' \
'r-randomforest' \
'r-rcurl' \
'r-rmarkdown' \
'r-rodbc' \
'r-rsqlite' \
'r-shiny' \
'r-tidymodels' \
'r-tidyverse' \
'unixodbc' && \
I did not install mamba
, so i will just install the above libs, using conda
directly, just like i did install r
and r-ikernel
libs, followed by a global conda
update. I will also install first the apt-get
installed linux packages:
apt-get update --yes && \
apt-get install --yes --no-install-recommends \
fonts-dejavu \
unixodbc \
unixodbc-dev \
r-cran-rodbc \
gfortran \
gcc && \
apt-get clean && rm -rf /var/lib/apt/lists/*
conda install --yes \
'r-base' \
'r-caret' \
'r-crayon' \
'r-devtools' \
'r-e1071' \
'r-forecast' \
'r-hexbin' \
'r-htmltools' \
'r-htmlwidgets' \
'r-irkernel' \
'r-nycflights13' \
'r-randomforest' \
'r-rcurl' \
'r-rmarkdown' \
'r-rodbc' \
'r-rsqlite' \
'r-shiny' \
'r-tidymodels' \
'r-tidyverse' \
'unixodbc' && \
conda clean --all -f -y && \
conda update --all -y
# mamba clean --all -f -y && \
# fix-permissions "${CONDA_DIR}" && \
# fix-permissions "/home/${NB_USER}
Yet, before trying the above huge changes, even if they make sense, I will do something that makes just as much sense, and brigns a much smaller change:
cairo
conda
-installed package, cannot find the libXrender.so.1
filelibxrender
, then maybe cairo
will then successfully find this libXrender.so.1 file ?libxrender
? I can only think of two ways: using apt-get
or conda
apt-get
package managerdocker-compose exec -T jupyter_deno bash -c "source ~/.bashrc && apt-get install -y libxrender1"
sudo reboot -h now
it worksssssssssssssss ❤️ !!!! so manyyy thanks https://github.com/jfpuget !!!
I may consider later to add the above huge list of packages, but for now, I iwll stick to the KISS principle and the (why updating something that already works ?)
We'lll say its done with https://github.com/decoder-leco/poc-data-visualization/releases/tag/0.0.1