On this page:
Table of Contents |
---|
...
As you work in RStudio, occasionally you might want to reset your R user package library. This is useful if, for example, you have multiple issues with the R packages that you have installed, making it difficult for you to use these packages. In that case, you might want to remove all R packages that you have installed and start your R user library from a blank slate.
In IDAS, R packages are installed to the user library at:
Info |
---|
/home/HAWKID/R/x86_64-pc-linux-gnu-library/x.x |
where HAWKID is your HawkID, and x.x is the major version of R, such as 3.6, 4.0, 4.1, 4.2, 4.3, etc.
In RStudio, you can see those folders in the “Files” pane. There’s 1 folder for each R version you have used in IDAS, as in the screenshot below:
...
If you delete or rename those folders and restart your IDAS session, when you log in again, a new empty folder will be created for the R version that you’re using. That should give you a blank slate so that you can re-install any packages you need.
Warning |
---|
Deleting the folders at /home/HAWKID/R/x86_64-pc-linux-gnu-library will delete all packages that you have installed. Renaming the folders will create a backup of the installs in case you want to look back at them. It’s up to you which way you prefer. Data in IDAS are not backed up on the server side, so in general, please back up data as needed before you delete them. If you would like to download data from your IDAS account to your personal computer, please see this support article. |
Resetting R User Package Library
...
1. Log in to IDAS from https://notebooks.hpc.uiowa.edu/.
2. In the RStudio “Files” pane, click to navigate to the “R/x86_64-pc-linux-gnu-library” folder as shown in the screenshot below. Then click the check box in front of the folder “3.6” and click “Rename”.
3. In the dialogue box, rename the folder to “3.6-231025”. (You can choose to rename the 3.6 folder using a different name.) Then click "OK".
4. After renaming, your “Files” pane will look like the following:
5. Follow the steps here to restart your IDAS server.
6. When you log into IDAS again, select R 3.6.1 in the Server Options form. More info about filling out the Server Options form can be found in this support article.
7. When you start RStudio again, a new “3.6” folder will be created:
...
8. That “3.6” folder will be empty, giving you a blank slate to reinstall packages:
...
9. By renaming the "3.6" folder, we created a backup of the packages that were installed for R 3.6 in case you want to look back at them. Since these folders can be large and take up space, when you are sure that you no longer need the old versions, you can simply delete them.
10. To reinstall packages to R 3.6, first use .libPaths() in R to check that you have the correct R version. In this example, we're reinstalling packages to R 3.6 and we see that .libPaths() is displaying the correct version:
Code Block |
---|
> .libPaths() [1] "/home/HawkID/R/x86_64-pc-linux-gnu-library/3.6" "/opt/R/lib/R/library" |
If .libPaths() is not showing the correct R version that you are using, you may need to set the user library path, using the following R command:
Code Block |
---|
> .libPaths("~/R/x86_64-pc-linux-gnu-library/3.6") |
11. Then you can reinstall packages using install.packages() as usual.
Code Block |
---|
> install.packages("abind") Installing package into ‘/home/HawkID/R/x86_64-pc-linux-gnu-library/3.6’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/src/contrib/abind_1.4-5.tar.gz' Content type 'application/x-gzip' length 21810 bytes (21 KB) ================================================== downloaded 21 KB * installing *source* package ‘abind’ ... ** package ‘abind’ successfully unpacked and MD5 sums checked ** using staged installation ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (abind) The downloaded source packages are in ‘/tmp/RtmplD36Sc/downloaded_packages’ |
...