R Igraph 2.0.1.1 installation fails on ubuntu 20.04.06 desktop

As above. I am running an ubuntu 20.04 LT desktop on a university research computer on which I do not have administrator rights. install.packages(‘igraph’) runs for quite a while, but then abends (on several attempts) with the final command and error message as i give below. Oddly, I have had no problem installing igraph 2.0.1.1 on an ubuntu 22.04 container on my home pc. Even more oddly, the admin folks have been able to install igraph with no problem on their desktop that they tell me is identically set up as mine. The admins note that I have installed the R package reticulate and run reticulate::install_python(), which sets up a library that may include the same packages that R igraph may be requiring. They speculate that this may be setting up a mapping of the ubuntu packages that conflicts with what is expected by igraph. This is beyond me. But I am hoping that you can help me get igraph 2.0.1.1 installed.

Many thanks for any help that you can give me to get igraph 2.0.0.1 successfully installed!
Larry Hunsicker

Following what szhorvat requested in response to springc’s message of Aug 2023 " Unable to install igraph on Mac for R, I am attaching the following setup information:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal

uname -a
Linux idas-research-hunsickerl 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

which R
/opt/R/bin/R

R --version
R version 4.3.1 (2023-06-16) – “Beagle Scouts”
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
Licenses - GNU Project - Free Software Foundation.

R CMD config --all
CC = gcc
CFLAGS = -g -O2
CPICFLAGS = -fpic
CPPFLAGS = -I/usr/local/include
CC17 = gcc -std=gnu17
C17FLAGS = -g -O2
CC23 = gcc -std=gnu2x
C23FLAGS = -g -O2
CC90 = gcc -std=gnu90
C90FLAGS = -g -O2
CC99 = gcc -std=gnu99
C99FLAGS = -g -O2
CXX = g++ -std=gnu++17
CXXFLAGS = -g -O2
CXXPICFLAGS = -fpic
CXX11 = g++
CXX11STD = -std=gnu++11
CXX11FLAGS = -g -O2
CXX11PICFLAGS = -fpic
CXX14 = g++
CXX14STD = -std=gnu++14
CXX14FLAGS = -O3 -march=native -mtune=native -fPIC
CXX14PICFLAGS = -fpic
CXX17 = g++
CXX17STD = -std=gnu++17
CXX17FLAGS = -g -O2
CXX17PICFLAGS = -fpic
CXX20 =
CXX20STD =
CXX20FLAGS =
CXX20PICFLAG =
CXX23 =
CXX23STD =
CXX23FLAGS =
CXX23PICFLAGS =
DYLIB_EXT = .so
DYLIB_LD = gcc
DYLIB_LDFLAGS = -shared -fopenmp
FC = gfortran
FFLAGS = -g -O2
FPICFLAGS = -fpic
FLIBS = -lgfortran -lm -lquadmath
FCFLAGS = -g -O2
SAFE_FFLAGS = -g -O2 -msse2 -mfpmath=sse
OBJC =
OBJCFLAGS =
JAVA = /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
JAVAC = /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
JAVAH = /usr/lib/jvm/java-8-openjdk-amd64/bin/javah
JAR = /usr/lib/jvm/java-8-openjdk-amd64/bin/jar
JAVA_HOME = /usr/lib/jvm/java-8-openjdk-amd64
JAVA_LIBS = -L/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server -ljvm
JAVA_CPPFLAGS = -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux
LDFLAGS = -L/usr/local/lib
SHLIB_CFLAGS =
SHLIB_CXXFLAGS =
SHLIB_CXXLD = g++ -std=gnu++17
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX11LD = g++ -std=gnu++11
SHLIB_CXX11LDFLAGS = -shared
SHLIB_CXX14LD = g++ -std=gnu++14
SHLIB_CXX14LDFLAGS = -shared
SHLIB_CXX17LD = g++ -std=gnu++17
SHLIB_CXX17LDFLAGS = -shared
SHLIB_CXX20LD =
SHLIB_CXX20LDFLAGS = -shared
SHLIB_CXX23LD =
SHLIB_CXX23LDFLAGS = -shared
SHLIB_EXT = .so
SHLIB_FFLAGS =
SHLIB_LD = gcc
SHLIB_LDFLAGS = -shared
TCLTK_CPPFLAGS = -I/usr/include/tcl8.6 -I/usr/include/tcl8.6
TCLTK_LIBS = -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -L/usr/lib/x86_64-linux-gnu -ltk8.6 -lX11 -lXss -lXext
BLAS_LIBS = -L/opt/R/lib/R/lib -lRblas
LAPACK_LIBS = -L/opt/R/lib/R/lib -lRlapack
MAKE = make
LIBnn = lib
AR = ar
NM = /usr/bin/nm -B
RANLIB = ranlib
LTO =
LTO_FC =
LTO_LD =

The following variables are defunct

CPP CXXCPP

gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~/.R$ more Makevars
CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=g++

CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=g++

Final output just before the install.packages("igraph) abended:

gcc -I"/opt/R/lib/R/include" -DNDEBUG -DUSING_R -I. -Ivendor -Ivendor/cigraph/src -Ivendor/cigraph/include -Ivendor/cigraph/vendor -I"/opt/conda/include/libxml2 -I/opt/conda/include" -DNDEBUG -DNTIMER -DNPRINT -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL= -DPRPACK_IGRAPH_SUPPORT -DHAVE_GFORTRAN=1 -D_GNU_SOURCE=1 -I’/home/hunsickerl/R/x86_64-pc-linux-gnu-library/4.3/cpp11/include’ -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c vendor/cigraph/src/io/graphml.c -o vendor/cigraph/src/io/graphml.o
vendor/cigraph/src/io/graphml.c:46:10: fatal error: libxml/globals.h: No such file or directory
46 | #include <libxml/globals.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.

There are two problems here:

  1. One bug in igraph: Invalid quoting of libxml2 include path · Issue #1181 · igraph/rigraph · GitHub
  2. You are compiling with a conda environment active. Never do this, it causes many problems. Deactivate it (conda deactivate) and try again. It will likely succeed, despite the above-mentioned bug.

We can tell this from the part I bolded:

That didn’t work. I ran “conda deactivate” in the shell, then rebooted Rstudio/R, and got the same error, including the same conda include code.

gcc -I"/opt/R/lib/R/include" -DNDEBUG -DUSING_R -I. -Ivendor -Ivendor/cigraph/src -Ivendor/cigraph/include -Ivendor/cigraph/vendor -I"/opt/conda/include/libxml2 -I/opt/conda/include" -DNDEBUG -DNTIMER -DNPRINT -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL= -DPRPACK_IGRAPH_SUPPORT -DHAVE_GFORTRAN=1 -D_GNU_SOURCE=1 -I’/home/hunsickerl/R/x86_64-pc-linux-gnu-library/4.3/cpp11/include’ -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c vendor/cigraph/src/io/graphml.c -o vendor/cigraph/src/io/graphml.o
vendor/cigraph/src/io/graphml.c:46:10: fatal error: libxml/globals.h: No such file or directory
46 | #include <libxml/globals.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.

Evidently the conda didn’t get deactivated. The way things are set up here, I only have access to the shell via the terminal tab on RStudio. I suspect that “conda deactivate” doesn’t work if conda is in use in an application on that terminal instance. The conda gets activated via the R package reticulate. There must be a way using reticulate to inactivate conda. I’ll see what I can find in the reticulate manual. I’ll let you know what I find.

Thanks for your prompt response, and for pointing me in the right direction.
Larry

Run the command line version of R from the same terminal where you deactivated conda, and install from there. So, all from the same terminal, one by one:

  • conda deactivate
  • R
  • install.packages('igraph')

Do not use RStudio for the installation. You can use RStudio later once installation succeeded.

Let me know if this worked. If not, can you post the error message along with the preceding compilation command, just like you did before?

For the future, ideally, set up conda in a way that it is not active by default. I also use conda, but only activate it when I use it. See the last paragraph here.

Bingo! I found a way to login to the basic ubuntu environment without going through RStudio, then opened native R. There the installation of igraph went without a hitch.
Now I’m going to test whether it works right in my screwed up environment. Then I’ll work on figuring out how to turn conda off and on in the future. Right now, I need to use igraph.
Many thanks!! Larry

Works fine. Many, many thanks.
Larry

1 Like

szhorvat: I am now able to use igraph just fine. So my original problem has been solved. Specifically, I have confirmed that I can install igraph using base R, though not when using RStudio. But I am still a bit anxious about your comment that interactions with conda while working in R/Rstudio can be problematic. I am working on a problem that relies for some issues on igraph and for other issues involving deep learning on python, accessed using the reticulate, tensorflow, and keras packages. So I have tried to identify the spot where the ability to install igraph in RStudio is broken. To this end I have completely removed all traces of reticulate, tensorflow, and keras, and returned the $PATH to the original status of my workstation. Despite this, I still cannot install igraph in RStudio, but I still can install igraph from base R. This suggests to me that the problem may lie not with reticulate and conda, but rather there is something being retained in RStudio that is causing the problem – perhaps something in the build variables in RStudio.
My concern is whether going back and forth between R and igraph and python via conda or the reticulate, tensorflow, and keras packages is going to hang me up in the future. Do you have any further suggestions about where the above problem lies, and what I can do to avoid hitting a block.
Many thanks for any thoughts that you may have about this. Larry Hunsicker