I recently set up Jupyter Notebook with R using the IRKernel but I am facing an issue where RStudio and Jupyter seem to behave differently when detecting installed packages. Packages installed through RStudio work fine within RStudio but when I try to load them in a Jupyter Notebook, I get errors saying the package is not found. However, running .libPaths() in both environments shows different library paths; which might be causing the issue.

I have tried explicitly setting the library path using .libPaths() in Jupyter Notebook, reinstalling the packages from within Jupyter & ensuring that both RStudio and Jupyter are using the same R version. Despite these efforts; the issue persists.

Has anyone else encountered this issue with IRKernel? What’s the best way to ensure a consistent package environment across RStudio and Jupyter? Any advice would be appreciated!
Thank you !!

Salesforce Developer