Installation of package igraph in R

Creation date: 9/13/2024 1:07 PM    Updated: 7/18/2025 11:48 AM   igraph r r igraph
NOTE: the same instructions work for newer versions of R and for newer versions of igraph (e.g., as of July, 2025: `wget https://ftp.osuosl.org/pub/cran/src/contrib/igraph_2.1.4.tar.gz`).

R version 4.4.0:

qrsh -l h_data=10G
module load gcc/10.2.0; module load R/4.4.0; module load glpk
wget https://cran.r-project.org/src/contrib/Archive/igraph/igraph_2.0.3.tar.gz
tar xvf igraph_2.0.3.tar.gz
cd igraph; patch < /u/local/apps/igraph/HOW_TO_INSTALL_IN_R/configure.patch
cd ..
if [ ! -d $R_LIBS_USER ] ; then mkdir -p $R_LIBS_USER ; fi  # assuming sh/bash-based shell
# perform installation of dependencies (installation of igraph will fail)
R -e "install.packages('igraph',lib=Sys.getenv('R_LIBS_USER'),dependencies=TRUE, repos='https://ftp.osuosl.org/pub/cran/')"
# now install patched version of igraph:
R CMD INSTALL igraph
# you can then remove the igraph directory


R version 4.4.1:

qrsh -l h_data=10G
module load gcc/10.2.0; module load R/4.4.1; module load glpk
wget https://cran.r-project.org/src/contrib/Archive/igraph/igraph_2.0.3.tar.gz
tar xvf igraph_2.0.3.tar.gz
cd igraph; patch < /u/local/apps/igraph/HOW_TO_INSTALL_IN_R/configure.patch
cd ..
if [ ! -d $R_LIBS_USER ] ; then mkdir -p $R_LIBS_USER ; fi  # assuming sh/bash-based shell
# perform installation of dependencies (installation of igraph will fail)
R -e "install.packages('igraph',lib=Sys.getenv('R_LIBS_USER'),dependencies=TRUE, repos='https://ftp.osuosl.org/pub/cran/')"
# now install patched version of igraph:
R CMD INSTALL igraph
# you can then remove the igraph directory