How to update R libraries in Jupyter (with/without using conda command)?

I am getting an error saying that a certain version of a library(caret) is lower than required, and I need to update it.

That’s not a lot to go on, but perhaps, if:

  • you installed with conda
  • from conda-forge

…to upgrade caret to 6.0:

  • open a terminal
  • (maybe) ensure you are in the same environment as the kernel
conda activate my-r-environment
  • upgrade
conda install -c conda-forge "r-caret>=6.0"

Longer term: it’s usually worth it to have some idea about your direct dependencies, and build and check in an environment.yml:

name: my-r-environment
  - conda-forge
  - jupyterlab >=3.1,<4
  - r-irkernel >=1.3,<1.4
  - r-caret >=6.0,<7.0

That you can then keep up-to-date with:

conda env update --file environment.yml
1 Like