igraph / rigraph

igraph R package
https://r.igraph.org
554 stars 200 forks source link

installation of package ‘igraph’ had non-zero exit status #213

Closed liuyifang closed 7 years ago

liuyifang commented 7 years ago

Hi The igraph r package has the same bug as igraph in https://github.com/igraph/igraph/commit/0ddc7727381d69eb54a17fa27114554712f6f5d5

foreign-graphml.c: In function ‘igraph_write_graph_graphml’: foreign-graphml.c:1408:46: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’ ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n"); ^ foreign-graphml.c:1412:59: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’ ret=fprintf(outstream, " xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n"); ^ foreign-graphml.c:1414:38: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’ ret=fprintf(outstream, " " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n"); ^ make: *** [foreign-graphml.o] Error 1 ERROR: compilation failed for package ‘igraph’

gaborcsardi commented 7 years ago

This is unfortunately a bug in igraph. To work around it you need a newer compiler, or wait for the next igraph release.

liuyifang commented 7 years ago

Thanks for your information. Could you tell the next igraph release date, if it will be soon, I can wait.

gaborcsardi commented 7 years ago

I would do it today if I could, but CRAN does not like that. But surely within two weeks I would say.

Btw. I think you can also apply this patch: https://github.com/igraph/igraph/pull/1020/files if you don't want to wait.

liuyifang commented 7 years ago

Thanks for your advice, I manually update the source code and solved this bug. But I meet another issue:

Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/home/liuyf/R/R_LIBS/igraph/libs/igraph.so': libiconv.so.2: cannot open shared object file: No such file or directory Error: loading failed Execution halted ERROR: loading failed

My R Environment:

CentOS Linux release 7.3.1611 (Core) gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11) R 3.4.1

liuyifang commented 7 years ago

Problem solved. This is because my CentOS system does not contain libiconv.so.2 shared library. To solve this:

wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz tar -zxvf libiconv-1.15.tar.gz cd libiconv-1.15 ./configure --prefix=/usr/local make make install

Then

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

arpitghiya-zz commented 7 years ago

Hello

I have followed your suggestion and applied the patch in the source code. Although, this time I am getting a different error while installing igraph. Can you please help.

src/foreign-gml-lexer.l:102: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -I/usr/local/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=// -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c foreign-gml-parser.c -o foreign-gml-parser.o In file included from src/foreign-gml-parser.y:59: igraph_hacks_internal.h:42:1: warning: "strdup" redefined In file included from /usr/include/string.h:637, from src/foreign-gml-parser.y:54: /usr/include/bits/string2.h:1316:1: warning: this is the location of the previous definition gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -I/usr/local/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=// -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fpic -fPIC -c foreign-graphml.c -o foreign-graphml.o foreign-graphml.c: In function ‘igraph_write_graph_graphml’: foreign-graphml.c:1408: error: ‘GRAPHML_NAMESPACE_URI’ undeclared (first use in this function) foreign-graphml.c:1408: error: (Each undeclared identifier is reported only once foreign-graphml.c:1408: error: for each function it appears in.) make: *** [foreign-graphml.o] Error 1 ERROR: compilation failed for package ‘igraph’

liuyifang commented 7 years ago

Hi You need also update src/foreign-graphml.c following this link: https://github.com/igraph/igraph/commit/9acfa54fa6b3d182fe458434a497f4e9b5c39955 Then it will be ok.

arpitghiya-zz commented 7 years ago

Thanks! This helped

SKrPl commented 7 years ago

@gaborcsardi I am still facing the same problem while installing.

Norali81 commented 7 years ago

Hi, is there anywhere I can find instructions on how to apply the patch? Thanks a lot!

liuyifang commented 7 years ago

You can just change the source code src/foreign-graphml.c manually following https://github.com/igraph/igraph/pull/1020/files and https://github.com/igraph/igraph/commit/9acfa54fa6b3d182fe458434a497f4e9b5c39955 then compile igraph following this http://kbroman.org/pkg_primer/pages/build.html

Norali81 commented 7 years ago

Great! Thanks so much!

colinwxl commented 6 years ago

My system is Ubutu16.04LTS, I've solved this problem by sudo apt-get install libxml2-dev, refer to http://www.genek.tv/article/40

sbaudoin commented 6 years ago

On RHEL, I had to install libxml2-devel (and maybe libssh2-devel too) for the package to compile and get installed.

whitleyo commented 6 years ago

Hi,

I get a similar problem when installing igraph in R:

Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/owenwhitley/R/x86_64-pc-linux-gnu-library/3.4/igraph/libs/igraph.so':
  libgfortran.so.4: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted

Looking through the console, I get these warnings:

In file included from src/foreign-gml-parser.y:54:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined [enabled by default]
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:635:0,
                 from src/foreign-gml-parser.y:49:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)

In file included from src/foreign-lgl-parser.y:49:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined [enabled by default]
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:635:0,
                 from src/foreign-lgl-parser.y:48:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)
 ^

In file included from src/foreign-ncol-parser.y:49:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined [enabled by default]
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:635:0,
                 from src/foreign-ncol-parser.y:48:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)
 ^

In file included from hacks.c:27:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined [enabled by default]
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:635:0,
                 from /usr/include/memory.h:29,
                 from hacks.c:24:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)
 ^

Here's the session info:

sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.0
LAPACK: /usr/lib/lapack/liblapack.so.3.0

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8    LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4    yaml_2.1.18  

Would it be recommended that I upgrade to Ubuntu 16.04?

Thanks!

liuyifang commented 6 years ago

Hi, I recommend you try install libgfortran following this link: https://stackoverflow.com/questions/46516394/how-to-install-libgfortran-so-4-on-ubuntu-16-06

EricPeter commented 6 years ago

Install those packages sudo apt-get install libpoppler-cpp-dev
sudo apt-get install libapparmor-dev

bplatt21 commented 6 years ago

Hey all, super new to this, so go easy! I am getting this error, which I have no idea what it is.

`make: gfortran-4.8: No such file or directory make: *** [AMD/Source/amd.o] Error 1 ERROR: compilation failed for package ‘igraph’

The downloaded source packages are in ‘/private/var/folders/x8/kpthc3ks2tg5g85hgf30mnkc0000gp/T/RtmpTtA3oc/downloaded_packages’ Warning message: In install.packages("igraph") : installation of package ‘igraph’ had non-zero exit status`

I've tried all the suggestions above to solve the non-zero exit status issue but nothing is working. I also tried to download the package suggested in the error. /private/var/folders/x8/kpthc3ks2tg5g85hgf30mnkc0000gp/T/RtmpTtA3oc/downloaded_packages

Also, I tried to do some of the sudo apt- commands, and I get

Error: unexpected symbol in "sudo apt"

Nothing is working, what am I doing wrong?

gaborcsardi commented 6 years ago

You need a fortran compiler.

bplatt21 commented 6 years ago

Ok thanks, any recommendations on which one? I am notorious for getting the wrong documents and downloading them to the wrong location, it always seems to happen!

gaborcsardi commented 6 years ago

Ok thanks, any recommendations on which one?

@bplatt21 I don't know, it depends on your system. Btw. commenting on closed issues is not the best way to reach the developers.... open a new issue if you have problems.

D-Harouni commented 4 years ago

Followed some suggestion but still getting the following:

Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/home/elharoun/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-igraph/00new/igraph/libs/igraph.so': libgfortran.so.4: cannot open shared object file: No such file or directory Error: loading failed Execution halted

shubham1637 commented 4 years ago

Use the following commands to install libgfortran

sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
sudo apt-get install gcc-7 g++-7
sudo apt-get install gfortran-7
yuxiaokang-source commented 3 years ago

I get the same error( my environment is ununtu20.04,R 4.1.0), I run sudo apt install gfortran-7 in terminal, then I run install.packages("igraph") in rstudio, it run successfully

taosun112 commented 3 years ago

I get the same error( my environment is ununtu20.04,R 4.1.0), I run sudo apt install gfortran-7 in terminal, then I run install.packages("igraph") in rstudio, it run successfully 我也出现了同样的问题,可以帮助一下我吗? stao1211@163.com

MEFarhadieh commented 8 months ago

For installation of package ‘igraph’ had non-zero exit status warning or error on Google Colab for R can run the below code in R notebook which was discussed in https://igraph.discourse.group/t/failures-in-installing-igraph-on-google-colab-for-r/1745 system('apt-get install libglpk-dev libgmp-dev libxml2-dev', intern=T)