Search code examples
r32bit-64bitjupyterjupyter-irkernel

Change Jupyter R-Kernel engine from 32 bit to 64 bit easily


I'm using Jupyter with R Kernel to create training forms. With some packages of R, I need to use a 32 bit release of R engine, and for others (the main part) 64 bit.

So my goal is to be able to switch really easily from a R Kernel 32 bit to a R Kernel 64 bit really easily.

From now on, the only thing I've been able to do is

  • getting a 32 bit R Kernel Under Jupyter when I previously installed the Kernel Under a 32bit version of my R engine
  • getting a 64 bit R Kernel when previously installed the packages and the R Kernel Under a 64 bit R engine

To install the Kernel, my code is always the same :

    install.packages(c('repr', 'IRkernel', 'IRdisplay'),
     repos = c('http://irkernel.github.io/', getOption('repos')))
IRkernel::installspec()

Solution

  • The easiest way is to edit your kernel spec file:

    • Under windows, got to %USERPROFILE%\AppData\Roaming\jupyter\kernels\ and copy the ir folder to e.g. ir64bit
    • edit the kernel.json file so that it reads [...]"argv": ["C:/PROGRA~1/R/R-3.2/bin/x64/R.exe", [...] -> full path to R in the x64 (or i386) subfolder of bin.
    • change the display name to something you recognise in the UI (e.g. in this case "R 3.2 64bit").
    • restart the notebook server