Problem to install Bioconductor package

Hi, I want to install the package phyloseq from bioconductor using Rstudio (Version 1.1.463 ) with this command:

source('http://bioconductor.org/biocLite.R')
biocLite('phyloseq')

But I get this error:

/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [vegan.so] Error 1
ERROR: compilation failed for package ‘vegan’
* removing ‘/usr/local/lib/R/site-library/vegan’
ERROR: dependencies ‘ade4’, ‘ape’, ‘igraph’, ‘vegan’ are not available for package ‘phyloseq’
* removing ‘/usr/local/lib/R/site-library/phyloseq’

The downloaded source packages are in
	‘/tmp/Rtmp1Cty9l/downloaded_packages’
installation path not writeable, unable to update packages: mgcv
Warning messages:
1: 'biocLite' is deprecated.
Use 'BiocManager::install' instead.
See help("Deprecated") 
2: In install.packages(pkgs = doing, lib = lib, ...) :
  installation of package ‘ade4’ had non-zero exit status
3: In install.packages(pkgs = doing, lib = lib, ...) :
  installation of package ‘ape’ had non-zero exit status
4: In install.packages(pkgs = doing, lib = lib, ...) :
  installation of package ‘igraph’ had non-zero exit status
5: In install.packages(pkgs = doing, lib = lib, ...) :
  installation of package ‘vegan’ had non-zero exit status
6: In install.packages(pkgs = doing, lib = lib, ...) :
  installation of package ‘phyloseq’ had non-zero exit status

This is the information from sessionInfo()

R version 3.5.2 (2018-12-20)
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_US.UTF-8       LC_NUMERIC=C               LC_TIME=nb_NO.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=nb_NO.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=nb_NO.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=nb_NO.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] BiocManager_1.30.4   BiocInstaller_1.32.1 usethis_1.4.0        devtools_2.0.1      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0        rstudioapi_0.9.0  magrittr_1.5      pkgload_1.0.2     R6_2.3.0          rlang_0.3.1       tools_3.5.2      
 [8] pkgbuild_1.0.2    sessioninfo_1.1.1 cli_1.0.1         withr_2.1.2       remotes_2.0.2     yaml_2.2.0        assertthat_0.2.0 
[15] digest_0.6.18     rprojroot_1.3-2   crayon_1.3.4      processx_3.2.1    callr_3.1.1       fs_1.2.6          ps_1.3.0         
[22] curl_3.3          testthat_2.0.1    memoise_1.1.0     glue_1.3.0        compiler_3.5.2    desc_1.2.0        backports_1.1.3  
[29] prettyunits_1.0.2

Thanks for the help

As your error message sais, biocLite is deprecated, try this instead:

install.packages("BiocManager")
BiocManager::install('phyloseq')

Hi Andresrcs, After your suggestion:

I got this error

/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/usr/local/lib/R/site-library/igraph’
* installing *source* package ‘vegan’ ...
** package ‘vegan’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c data2hill.c -o data2hill.o
gfortran   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4  -c decorana.f -o decorana.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c getF.c -o getF.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c goffactor.c -o goffactor.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gfortran   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4  -c monoMDS.f -o monoMDS.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c nestedness.c -o nestedness.o
gfortran   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4  -c ordering.f -o ordering.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c pnpoly.c -o pnpoly.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c stepacross.c -o stepacross.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c vegdist.c -o vegdist.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o vegan.so data2hill.o decorana.o getF.o goffactor.o init.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -llapack -lblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [vegan.so] Error 1
ERROR: compilation failed for package ‘vegan’
* removing ‘/usr/local/lib/R/site-library/vegan’
ERROR: dependencies ‘ade4’, ‘ape’, ‘igraph’, ‘vegan’ are not available for package ‘phyloseq’
* removing ‘/usr/local/lib/R/site-library/phyloseq’

The downloaded source packages are in
	‘/tmp/RtmpVktgSE/downloaded_packages’
installation path not writeable, unable to update packages: mgcv
Update old packages: 'decontam'
Update all/some/none? [a/s/n]: 
a
trying URL 'https://bioconductor.org/packages/3.8/bioc/src/contrib/decontam_1.2.1.tar.gz'
Content type 'application/x-gzip' length 690837 bytes (674 KB)
==================================================
downloaded 674 KB

* installing *source* package ‘decontam’ ...
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (decontam)

The downloaded source packages are in
	‘/tmp/RtmpVktgSE/downloaded_packages’
Warning messages:
1: In install.packages(pkgs = doing, lib = lib, repos = repos, ...) :
  installation of package ‘ade4’ had non-zero exit status
2: In install.packages(pkgs = doing, lib = lib, repos = repos, ...) :
  installation of package ‘ape’ had non-zero exit status
3: In install.packages(pkgs = doing, lib = lib, repos = repos, ...) :
  installation of package ‘igraph’ had non-zero exit status
4: In install.packages(pkgs = doing, lib = lib, repos = repos, ...) :
  installation of package ‘vegan’ had non-zero exit status
5: In install.packages(pkgs = doing, lib = lib, repos = repos, ...) :
  installation of package ‘phyloseq’ had non-zero exit status

I have tried this on rstudio cloud and got the same error as you, but manually installing this dependencies (modelr, ade4, class, codetools, mgcv) before installing phyloseq made the trick for me.

install.packages(c('modelr', 'ade4', 'class', 'codetools', 'mgcv'))
BiocManager::install('phyloseq')

I run your suggestion:

install.packages(c('modelr', 'ade4', 'class', 'codetools', 'mgcv'))

and I got this:

Installing packages into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/modelr_0.1.3.tar.gz'
Content type 'application/x-gzip' length 119309 bytes (116 KB)
==================================================
downloaded 116 KB

trying URL 'https://cloud.r-project.org/src/contrib/ade4_1.7-13.tar.gz'
Content type 'application/x-gzip' length 3224440 bytes (3.1 MB)
==================================================
downloaded 3.1 MB

trying URL 'https://cloud.r-project.org/src/contrib/class_7.3-15.tar.gz'
Content type 'application/x-gzip' length 19757 bytes (19 KB)
==================================================
downloaded 19 KB

trying URL 'https://cloud.r-project.org/src/contrib/codetools_0.2-16.tar.gz'
Content type 'application/x-gzip' length 12996 bytes (12 KB)
==================================================
downloaded 12 KB

trying URL 'https://cloud.r-project.org/src/contrib/mgcv_1.8-27.tar.gz'
Content type 'application/x-gzip' length 915013 bytes (893 KB)
==================================================
downloaded 893 KB

* installing *source* package ‘modelr’ ...
** package ‘modelr’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded
* DONE (modelr)
* installing *source* package ‘ade4’ ...
** package ‘ade4’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c adesub.c -o adesub.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c divsub.c -o divsub.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c fourthcorner.c -o fourthcorner.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c phylog.c -o phylog.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c testamova.c -o testamova.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c testdim.c -o testdim.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c testrlq.c -o testrlq.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c tests.c -o tests.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ade4.so adesub.o divsub.o fourthcorner.o init.o phylog.o testamova.o testdim.o testrlq.o tests.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [ade4.so] Error 1
ERROR: compilation failed for package ‘ade4’
* removing ‘/usr/local/lib/R/site-library/ade4’
Warning in install.packages :
  installation of package ‘ade4’ had non-zero exit status
* installing *source* package ‘class’ ...
** package ‘class’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c class.c -o class.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o class.so class.o -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/class/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (class)
* installing *source* package ‘codetools’ ...
** package ‘codetools’ successfully unpacked and MD5 sums checked
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (codetools)
* installing *source* package ‘mgcv’ ...
** package ‘mgcv’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c coxph.c -o coxph.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c discrete.c -o discrete.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c gdi.c -o gdi.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c magic.c -o magic.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c mat.c -o mat.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c matrix.c -o matrix.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c mgcv.c -o mgcv.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c misc.c -o misc.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c mvn.c -o mvn.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c qp.c -o qp.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c soap.c -o soap.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c sparse-smooth.c -o sparse-smooth.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fopenmp -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c tprs.c -o tprs.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mgcv.so coxph.o discrete.o gdi.o init.o magic.o mat.o matrix.o mgcv.o misc.o mvn.o qp.o soap.o sparse-smooth.o tprs.o -llapack -lblas -lgfortran -lm -lquadmath -fopenmp -L/usr/lib/R/lib -lR
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [mgcv.so] Error 1
ERROR: compilation failed for package ‘mgcv’
* removing ‘/usr/local/lib/R/site-library/mgcv’
Warning in install.packages :
  installation of package ‘mgcv’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpCweIEF/downloaded_packages’

You are having issues with the system library lgfortran, fixing this could be a little triky, what is the output of running this commands in your system console?

which gfortran
gfortran --version

If run those commands in R I get this:

which gfortran
Error: unexpected symbol in "which gfortran"
gfortran --version
Error: object 'gfortran' not found

When I did it from the terminal I got this"

> which gfortran
/usr/bin/gfortran
> gfortran --version
GNU Fortran (Ubuntu 4.8.5-4ubuntu8~14.04.2) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

Try reinstalling this two in your terminal (not in R)

sudo apt purge gfortran r-base-dev
sudo apt install gfortran r-base-dev

Then try to install your packages again (in R)

If that doesn't work also try creating this symlink manually

sudo ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3 /usr/lib/libgfortran.so
3 Likes

After

sudo apt purge gfortran r-base-dev
sudo apt install gfortran r-base-dev

I managed to install the package (phyloseq) without any error. Thank you very much @andresrcs you have been very helpful.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.