Unable to install some packages in R

I cannot remember in which way I installed R. But my current version is:

platform       x86_64-suse-linux-gnu       
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          5.0                         
year           2018                        
month          04                          
day            23                          
svn rev        74626                       
language       R                           
version.string R version 3.5.0 (2018-04-23)
nickname       Joy in Playing  

When I want to update it tells me:

(base) main@linux-7qur:~> sudo zypper update R-base
[sudo] password for root: 
Loading repository data...
Reading installed packages...
No update candidate for 'R-base-3.5.0-lp151.6.53.x86_64'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.


Although it is not the most recent version. Working with it so far was fine. But now I really need the package “VGAM”.
Installing it gives me:

install.packages("VGAM")
Installing package into ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/VGAM_1.1-1.tar.gz'
Content type 'application/x-gzip' length 2624046 bytes (2.5 MB)
==================================================
downloaded 2.5 MB

* installing *source* package ‘VGAM’ ...
** package ‘VGAM’ successfully unpacked and MD5 sums checked
** libs
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g  -c VGAM_init.c -o VGAM_init.o
/bin/sh: gcc: command not found
make: *** [/usr/lib64/R/etc/Makeconf:159: VGAM_init.o] Error 127
ERROR: compilation failed for package ‘VGAM’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/VGAM’
* restoring previous ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/VGAM’
Warning in install.packages :
  installation of package ‘VGAM’ had non-zero exit status

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

So I downloaded the package on https://www.stat.auckland.ac.nz/~yee/VGAM/download.shtmland put it in the folder of the other packages. Then using library gives me:

library(VGAM)
Error in library(VGAM) : ‘VGAM’ is not a valid installed package

What to do? I need the package ASAP. I hope anyone is familiar with that problem.

regards

Install gcc, you’ll also likely need to install make and possibly configure(not always required).
Or, go into YaST > Software Manager and install the C Development pattern.

TSU

Hi
The ‘configure’ command is found in a source tarball, or if not, normally requires the auto tools (automake, autoconf, libtool etc) to regenerate with autoconf -vif.

I installed GCC7, nothing has changed. I don’t know what you mean by configure (especially not what it is about tarball). The command autoconf -vif does not exist.
Best

After installing gcc and prerequisites,
Post the new output from your compile attempt.
At the moment, don’t know if you still have a gcc problem or something new.

Compiling can be an iterative process… If you don’t know what the prerequisites are, then you can only keep doing compile tries, and each time the error will tell you what needs to be addressed.

TSU

The new error is:

install.packages("VGAM")
Installing package into ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/VGAM_1.1-1.tar.gz'
Content type 'application/x-gzip' length 2624046 bytes (2.5 MB)
==================================================
downloaded 2.5 MB

* installing *source* package ‘VGAM’ ...
** package ‘VGAM’ successfully unpacked and MD5 sums checked
** libs
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g  -c VGAM_init.c -o VGAM_init.o
/bin/sh: gcc: command not found
make: *** [/usr/lib64/R/etc/Makeconf:159: VGAM_init.o] Error 127
ERROR: compilation failed for package ‘VGAM’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/VGAM’
Warning in install.packages :
  installation of package ‘VGAM’ had non-zero exit status

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

Sorry. I saw that it was the same. So I installed gcc from https://software.opensuse.org/package/gcc

The new error is:

install.packages("VGAM")
Installing package into ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/VGAM_1.1-1.tar.gz'
Content type 'application/x-gzip' length 2624046 bytes (2.5 MB)
==================================================
downloaded 2.5 MB

* installing *source* package ‘VGAM’ ...
** package ‘VGAM’ successfully unpacked and MD5 sums checked
** libs
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g  -c VGAM_init.c -o VGAM_init.o
gcc -I"/usr/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g  -c caqo3.c -o caqo3.o
gfortran   -fpic  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g  -c cqof.f -o cqof.o
make: gfortran: Command not found
make: *** [/usr/lib64/R/etc/Makeconf:182: cqof.o] Error 127
ERROR: compilation failed for package ‘VGAM’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/VGAM’
Warning in install.packages :
  installation of package ‘VGAM’ had non-zero exit status

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

Ok. Thank you. I installed gcc-fortran and after many many warning during the installation process it works.
I have got the VGAM package. But this is not the solution to all my problems.

The next package is called lme4 and I get the following:

install.packages("lme4")
Installing package into ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependency ‘nloptr’

trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.2.1.tar.gz'
Content type 'application/x-gzip' length 2448313 bytes (2.3 MB)
==================================================
downloaded 2.3 MB

trying URL 'https://cran.rstudio.com/src/contrib/lme4_1.1-21.tar.gz'
Content type 'application/x-gzip' length 4124154 bytes (3.9 MB)
==================================================
downloaded 3.9 MB

* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking whether the C++ compiler works... no
configure: error: in `/tmp/RtmpD8kgd9/R.INSTALL30296e4b9c4d/nloptr':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘nloptr’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/nloptr’
Warning in install.packages :
  installation of package ‘nloptr’ had non-zero exit status
ERROR: dependency ‘nloptr’ is not available for package ‘lme4’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/lme4’
Warning in install.packages :
  installation of package ‘lme4’ had non-zero exit status

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

“R-lme4” seems to be a NetBSD package …

  • But, it seems that someone has submitted “R-lme4” to the archlinux repositories …

[HR][/HR]So, diving into the “R” world – as ever, a Bell Labs idea … :slight_smile:
You need:

  • R-core – which is in the openSUSE repositories, as is everything else listed here …
  • R-core-libs
  • R-core-packages: Compiler, Datasets, and so on and so on …
  • R-recommended-packages: Base, Matrix, MASS, and so on and so on …

Included in the “recommended packages” is: “R-nlme” …

I see. The thing is that I need to use what my colleagues use. So I need to stick to “lme4”.

I have a general question. If we find the solution for “lme4” could it be that again there is another package making problems again? Is there no general solution? All those packages are easily to install on windows OS.

I guess you can find the problem when I send the config.log file. Unfortunately, I cannot find one. Do you know how to open it or where it is?
Or do we not need it and there is a faster way to proceed?

Best

Hi
The output shows the error?


checking whether the C++ compiler works... no
configure: error: in `/tmp/RtmpD8kgd9/R.INSTALL30296e4b9c4d/nloptr':
configure: error: C++ compiler cannot create executables

Install gcc-c++ package.

Ok. The output shows the error. That is true. But I don’t always understand it. For the last case it was easy, but what shall I do here:
I needed to shorten it a little bit:
It starts where the problem starts:

 install.packages("devtools")
** 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 (processx)
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
 * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
 * rpm: libcurl-devel (Fedora, CentOS, RHEL)
 * csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status

...


** R
** inst
** byte-compile and prepare package for lazy loading
** help
Error : /tmp/Rtmpo9bkE1/R.INSTALL1fff7730ab1a/xml2/man/read_xml.Rd:48: unable to load shared object '/home/main/R/x86_64-suse-linux-gnu-library/3.5/xml2/libs/xml2.so':
  libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
* installing *source* package ‘evaluate’ ...
** package ‘evaluate’ 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 (evaluate)
* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
configure: loading site script /usr/share/site/x86_64-unknown-linux-gnu
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: Package dependency requirement 'libgit2 >= 0.26.0' could not be satisfied.

  -----------------------------------------------------------------------

   Unable to find the libgit2 library on this system. Building 'git2r'
   using the bundled source of the libgit2 library.

   To build git2r with a system installation of libgit2, please install:
     libgit2-dev   (package on e.g. Debian and Ubuntu)
     libgit2-devel (package on e.g. Fedora, CentOS and RHEL)
     libgit2       (Homebrew package on OS X)
   and try again.

   If the libgit2 library is installed on your system but the git2r
   configuration is unable to find it, you can specify the include and
   lib path to libgit2 with:

   given you downloaded a tar-gz archive:
   R CMD INSTALL git2r-.tar.gz --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'

   or cloned the GitHub git2r repository into a directory:
   R CMD INSTALL git2r/ --configure-vars='INCLUDE_DIR=/path/to/include LIB_DIR=/path/to/lib'

   or download and install git2r in R using
   install.packages('git2r', type='source', configure.vars='LIB_DIR=-L/path/to/libs INCLUDE_DIR=-I/path/to/headers')

   On macOS, another possibility is to let the configuration
   automatically download the libgit2 library from the Homebrew
   package manager with:

   R CMD INSTALL git2r-.tar.gz --configure-vars='autobrew=yes'
   or
   R CMD INSTALL git2r/ --configure-vars='autobrew=yes'
   or
   install.packages('git2r', type='source', configure.vars='autobrew=yes')

  -----------------------------------------------------------------------


configure: Attempting configuration of bundled libgit2
checking size of void*... 8
checking for library containing inflate... no
checking for zlib... no
configure: error: in `/tmp/RtmpCQbEU1/R.INSTALL210e166e5106/git2r':
configure: error: 
  ---------------------------------------------
   The zlib library that is required to build
   git2r was not found.

   Please install:
     zlib1g-dev (package on e.g. Debian and Ubuntu)
     zlib-devel (package on e.g. Fedora, CentOS and RHEL)
   and try again.

   If the zlib library is installed on your
   system but the git2r configuration is
   unable to find it, you can specify the
   include and lib path to zlib with:
   R CMD INSTALL git2r --configure-vars='LIBS=-L/path/to/libs CPPFLAGS=-I/path/to/headers'
  ---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/git2r’
Warning in install.packages :
  installation of package ‘git2r’ had non-zero exit status
* installing *source* package ‘remotes’ ...
** package ‘remotes’ successfully unpacked and MD5 sums checked
** 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 (remotes)
* installing *source* package ‘rprojroot’ ...
** package ‘rprojroot’ successfully unpacked and MD5 sums checked
** 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 (rprojroot)
* installing *source* package ‘callr’ ...
** package ‘callr’ successfully unpacked and MD5 sums checked
** 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 (callr)
ERROR: dependency ‘curl’ is not available for package ‘httr’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘roxygen2’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/roxygen2’
Warning in install.packages :
  installation of package ‘roxygen2’ had non-zero exit status

...

installing to /home/main/R/x86_64-suse-linux-gnu-library/3.5/testthat/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (testthat)
ERROR: dependency ‘httr’ is not available for package ‘gh’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/gh’
Warning in install.packages :
  installation of package ‘gh’ had non-zero exit status
* installing *source* package ‘pkgbuild’ ...
** package ‘pkgbuild’ 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 (pkgbuild)
ERROR: dependencies ‘curl’, ‘gh’, ‘git2r’ are not available for package ‘usethis’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/usethis’
Warning in install.packages :
  installation of package ‘usethis’ had non-zero exit status
* installing *source* package ‘rcmdcheck’ ...
** package ‘rcmdcheck’ 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 (rcmdcheck)
ERROR: dependencies ‘usethis’, ‘git2r’, ‘httr’, ‘roxygen2’ are not available for package ‘devtools’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

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

Best

Hi
Just search for the base name given and look for the development package, eg curl is libcurl-devel, git, libgit2-devel etc

Ok. Installed those + two more. Now the problem narrows down to “gh”:

> install.packages("devtools")

...

* installing *source* package ‘gh’ ...
** package ‘gh’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Error in rbind(info, getNamespaceInfo(env, "S3methods")) : 
  number of columns of matrices must match (see arg 2)
ERROR: lazy loading failed for package ‘gh’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/gh’
Warning in install.packages :
  installation of package ‘gh’ had non-zero exit status

...

** R
** inst
** byte-compile and prepare package for lazy loading
** help
Error : /tmp/RtmpicGJCV/R.INSTALL1c8815f0fd60/xml2/man/read_xml.Rd:48: unable to load shared object '/home/main/R/x86_64-suse-linux-gnu-library/3.5/xml2/libs/xml2.so':
  libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
ERROR: dependency ‘gh’ is not available for package ‘usethis’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/usethis’
Warning in install.packages :
  installation of package ‘usethis’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘roxygen2’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/roxygen2’
Warning in install.packages :
  installation of package ‘roxygen2’ had non-zero exit status
ERROR: dependencies ‘usethis’, ‘roxygen2’ are not available for package ‘devtools’
* removing ‘/home/main/R/x86_64-suse-linux-gnu-library/3.5/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpTRVjrX/downloaded_packages’
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/lib64/R/library/yaml/libs/yaml.so':
  /usr/lib64/R/library/yaml/libs/yaml.so: undefined symbol: MARK_NOT_MUTABLE
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/lib64/R/library/yaml/libs/yaml.so':
  /usr/lib64/R/library/yaml/libs/yaml.so: undefined symbol: MARK_NOT_MUTABLE

I downloaded the gh package as zip and put the package into my R packages folder.
But it still isn’t working:

> library("gh", lib.loc="~/R/x86_64-suse-linux-gnu-library/3.5")
Error: package or namespace load failed for ‘gh’ in rbind(info, getNamespaceInfo(env, "S3methods")):
 number of columns of matrices must match (see arg 2)
In addition: Warning message:
package ‘gh’ was built under R version 3.6.0 

It also doesn’t work, when I download the older version.

Any idea?

Best

Hi
Have you tried removing the .RData and .Rhistory files from the package folder and building again?

There are no such files. There are .RData files in another package. I deleted the whole package, but it did not change anything.

Best

The following describes your error in a different scenario… on Windows (debatable whether is relevant) and trying to install and run ggplot on an already installed R (who knows whether R was installed properly in the first place)

https://community.rstudio.com/t/ggplot2-packagde-installation-loading-error/32806/17

In the above scenario, one of the commentators suggested there could be a major difference between R versions 3.5 and 3.6.
Note also that your error says that the gh you’re trying to install was built for 3.6 whereas you’re trying to install 3.5.

I would suggest removing what you have installed and just install 3.6, you will have to add the following repository using the following command

zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_15.1/ LEAP_15.1_R_repository

HTH,
TSU

I would like to get 3.6. But there is only 3.5 available for Leap 15.1
See: openSUSE Software

I don’t think this was the main problem as I could also get the old release of the “gh”-package and it also did not work. The only thing that changes is that the “in addition” error is not there anymore.

I downloaded your repository although don’t understand for what it is for.
But it also does not seem to work:
[sudo] password for root:
Retrieving repository ‘LEAP_15.1_R_repository’ metadata …[error]
Repository ‘LEAP_15.1_R_repository’ is invalid.
[LEAP_15.1_R_repository|http://download.opensuse.org/reposit...USE_Leap_15.1/] Valid metadata not found at specified URL