Interfacing with R in Jupyter notebook with rpy2 package

Hello!

I am trying to load some R libraries in QR by using the rpy2 package to interface with R from a Jupyter notebook but without success.

The rpy2 package requires having R installed in the Anaconda environment which I was able to install by running:
conda install -c conda-forge r-base
Then I pip installed rpy2 with no issues.

In the notebook I loaded the package by running:
%load_ext rpy2.ipython

The rpy2 package uses magic commands to enable using R code in a Jupyter notebook by typing %%R at the top of cell followed by the R code.

I tried installing an R library called rmgarch with:
%%R install.packages('rmgarch', repos="http://cran.us.r-project.org")
But the cell doesn’t stop running once it starts and I have to restart the kernel to make it stop.

I am able to run the above steps in a local Jupyter notebook but can’t figure out why it’s not working in QR.

Appreciate any pointers on how to solve this.

I haven't used R so can't offer much guidance. Maybe try installing the package from the command line instead of in a notebook cell?

I wouldn't think QR's JupyterLab would meaningfully differ from a local Jupyter installation when it comes to using R.