4

I wanted to use R within Jupyter Notebook so I installed via R Essentials (see: https://www.continuum.io/blog/developer/jupyter-and-conda-r). The version that got installed is the following:

R.Version()

Out[2]:
$platform
"x86_64-w64-mingw32"
$arch
"x86_64"
$os
"mingw32"
$system
"x86_64, mingw32"
$status
""
$major
"3"
$minor
"1.3"
$year
"2015"
$month
"03"
$day
"09"
$svn rev
"67962"
$language
"R"
$version.string
"R version 3.1.3 (2015-03-09)"
$nickname
"Smooth Sidewalk"

I have attempted to update R and install some packages (like RWeka for example) to no avail. I have looked for various sources but nothing seems to point me in the right direction. Does anyone know what to do?

My main motivation is trying to use R libaries but will get warnings like the following:

library("RWeka")

Warning message:
: package 'RWeka' was built under R version 3.2.4Warning message:
In unique(paths): bytecode version mismatch; using eval
Kevin
  • 1,659
  • 5
  • 16
  • 22
  • 1
    I believe it uses whatever R build is on your system; you just need to update from within the R app (if your build has it) or by downloading a new version directly from [CRAN](http://cran.r-project.org/). – alistaire Mar 31 '16 at 19:35

3 Answers3

5

If you want to stay with conda packages, try conda update --all, but I think there are still no R 3.2.x packages for windows.

You can also install R via the binary installer available at r-project.org, install the R kernel manually; e.g. via

install_github("irkernel/repr")
install_github("irkernel/IRdisplay")
install_github("irkernel/IRkernel")

and then make this kernel available in the notebook

IRkernel::installspec(name = 'ir32', displayname = 'R 3.2')
tmthyjames
  • 1,588
  • 2
  • 22
  • 30
Jan Katins
  • 2,219
  • 1
  • 25
  • 35
1

In short, what you can do is update R on your machine, run the R console from within the anaconda environment and run step 5 and 6 below. This will update the version of R running in your anaconda environment.

For step by step instructions refer the below:

1.Update the latest R version in the R console. Refer this post.

2.Activate the required Anaconda environment in the terminal or Anaconda prompt using the below. Make sure you replace <my_env> with the name of your Jupyter environment.

conda activate my_env

3.Find out your <R_execution_path> using the R console with:

R.home("bin") 

Note: If you get a shortened pathname such as "C:/PROGRA~1/R/R-40~1.2/bin/x64", find the proper long path name by using your file explorer (or any other method).

4.Now execute the R console in your anaconda environment within the terminal or Anaconda prompt. Use your own <R_execution_path> with the below commands.

In the Linux terminal:

sudo <R_execution_path>/R

for example:

sudo /Library/Frameworks/R.framework/Resources/bin/R

OR

for Windows on Anaconda prompt (run as an Administrator and have my_env activated):

cd <R_execution_path>
R.exe

For example:

cd 'C:\Program Files\R\R-4.0.2\bin\x64\'
R.exe

5.Now run the below in the R console within the Jupyter environment

install.packages("IRkernel")
IRkernel::installspec()
q()

6.Restart your Jupyter notebook

jupyter notebook
Hawklaz
  • 306
  • 4
  • 20
0

My solution is for conda version.

  1. Remove the current R kernel from jupyter notebook:
jupyter kernelspec list
jupyter kernelspec remove <kernel_name>
  1. Create a new environment:
conda create -n <new_env_name>
  1. Activate the new environment:
conda activate <new_env_name>
  1. Install jupyter from conda-forge channel:
conda install -c conda-forge jupyter
  1. Install interactive R kernel from conda-forge channel:
conda install -c conda-forge r-irkernel 
  1. Run jupter notebook
jupyter notebook
Habib Karbasian
  • 556
  • 8
  • 18