Troubleshooting R - NUPulmonary/utils GitHub Wiki
Here I am including some helpful fixes when setting up Seurat in an R environment that may be difficult to find on the internet. Ideally, Seurat will install with simple install and library commands.
- It is common to receive an error along the lines of "could not install package hdf5". The following is courtesy of Nik.
- ssh into quest and type: module load R/4.1.1
- module load hdf5/1.8.19-serial
- R
- install.packages("hdf5r") To make sure it loads in your RStudio, add the line below to your .Rprofile file (which may be hidden, thus you need the . and will not see it in your terminal). This file is in your project folder, or the current working directory in your RStudio terminal
- dyn.load("/software/hdf5/1.8.19-serial/lib/libhdf5_hl.so.10")
- Another problem I just encountered that Rogan solved had to do with R failing to install the rgeos package. Granted, I was using an older version of R at first, but even with version 4.1.1 I had to load R and manually install the rgeos package with the following code.
- ssh into quest and run: module load R
- module avail geos
- module load geos (here specifically install the version or latest version listed)
- renv::load(<path to your r environment folder, likely just called renv in your project folder>) Now you should be able to install Seurat, which can be down from terminal or in RStudio (make sure to refresh RStudio and ensure rgeos is an available package).
- Not sure if others have gotten the following error, but upon loading my RStudio session, when I try to load packages I get: Error in renv_snapshot_auto_update(project = project) : could not find function "renv_snapshot_auto_update". The solution for this was to restore the project from the lockfile, which I did via the command line. Cd into the folder of the r environment you're using, then do module load R/4.1.1 (or whichever version you're using), then type R. With R pulled up on the command line, do renv::init(). You should be prompted with 4 options because the project already has a lockfile, select 1 (restore the project from the lockfile). Now, when you refresh RStudio the packages and environment should load correctly. You can quit R in the terminal with quit(), and no need to save the workspace image there.