I am trying to use R kernel in a Jupyter Notebook in an HPC environment. I have completed the following steps:
- created a conda environment
- installed latest R (4.4.1) in the environment
- installed
IRkernel
package - ran the code:
IRkernel::installspec(name='ir',displayname='R-4.4.1')
When I open the jupyter notebook through a browser, connected to the HPC, I do see the R kernel in there. Then I create a new jupyter notebook file with R kernel, which does open. When I try to run simple codes such as 2+3
it throws the following error:
Error in .External2(C_X11, paste0("png::", filename), g$width, g$height, :
unable to start device PNG
Calls: <Anonymous> ... evaluate -> dev.new -> do.call -> <Anonymous> -> ok_device
In addition: Warning message:
In ok_device(filename, ...) : no png support in this version of R
Execution halted
Possible solutions that I have tried:
- .Rprofile -> option(bitmapType=’cairo’) (ref: Can’t display png). I cannot find this file so cannot change it.
- Reinstalling R with ./configure –with-x=yes –with-libpng=yes –enable-R-shlib –prefix=$HOME
conda install anaconda::libpng
conda install conda-forge::cairo
- Installing
Cairo
package in R:install.packges("Cairo")
Not sure how to proceed from here.