"installation of package 'FILE_PATH' had non-zero exit status" in R

218,211

Solution 1

The .zip file provided by the authors is not a valid R package, and they do state that the source is for "direct use" in R (by which I assume they mean it's necessary to load the included functions manually). The non-zero exit status simply indicates that there was an error during the installation of the "package".

You can extract the archive manually and then load the functions therein with, e.g., source('bivpois.table.R'), or you can download the .RData file they provide and load that into the workspace with load('.RData'). This does not install the functions as part of a package; rather, it loads the functions into your global environment, making them temporarily available.

You can download, extract, and load the .RData from R as follows:

download.file('http://stat-athens.aueb.gr/~jbn/papers/files/14/14_bivpois_RDATA.zip', 
              f <- tempfile())
unzip(f, exdir=tempdir())
load(file.path(tempdir(), '.RData'))

If you want the .RData file to be available in the current working directory, to be loaded in the future, you could use the following instead:

download.file('http://stat-athens.aueb.gr/~jbn/papers/files/14/14_bivpois_RDATA.zip', 
              f <- tempfile())
unzip(f, exdir=tempdir())
file.copy(file.path(tempdir(), '.RData'), 'bivpois.RData')
# the above copies the .RData file to a file called bivpois.RData in your current 
# working directory.
load('bivpois.RData')

In future R sessions, you can just call load('bivpois.RData').

Solution 2

Simple install following libs on your linux.
curl: sudo apt-get install curl
libssl-dev: sudo apt-get install libssl-dev
libcurl: sudo apt-get install libcurl4-openssl-dev
xml2: sudo apt-get install libxml2-dev

Solution 3

You can try using command : install.packages('*package_name', dependencies = TRUE)

For example is you have to install 'caret' package in your R machine in linux : install.packages('caret', dependencies = TRUE)

Doing so, all the dependencies for the package will also be downloaded.

Solution 4

For those of you who are using MacOS and like me perhaps have been circling the internet as to why some R packages do not install here is a possible help.

If you get a non-zero exit status first check to ensure all dependencies are installed as well. Read through the messaging. If that is checked off, then look for indications such as gfortran: No such a file or directory. That might be due to Apple OS compiler issues that some packages will not install unless you use their binary version. Look for binary zip file in the package cran.r-project.org page, download it and use the following command to get the package installed:

install.packages("/PATH/zip file ", repos = NULL, type="source")

Solution 5

Did you check the gsl package in your system. Try with this:

ldconfig-p | grep gsl

If gsl is installed, it will display the configuration path. If it is not in the standard path /usr/lib/ then you need to do the following in bash:

export PATH=$PATH:/your/path/to/gsl-config 

If gsl is not installed, simply do

sudo apt-get install libgsl0ldbl
sudo apt-get install gsl-bin libgsl0-dev

I had a problem with the mvabund package and this fixed the error

Cheers!

Share:
218,211
Quantopik
Author by

Quantopik

BY DAY: quantitative risk manager @... Bank. BY NIGHT: data scientist for fun, quant for passion &amp; Linux user for love.

Updated on July 19, 2022

Comments

  • Quantopik
    Quantopik almost 2 years

    By installing the package in R using the following command:

    install.packages('FILE_PATH', repos=NULL, type = "source")
    

    I got the following error:

    Installing package into ‘/home/p/R/x86_64-pc-linux-gnu-library/3.0’ (as ‘lib’ is unspecified) Errore in rawToChar(block[seq_len(ns)]) : embedded nul in string: 'PK\003\004\024\0\002\0\b\0]\xadVCr\xcb\xea\xfcR\0\0\0\xa7\0\0\0\027\0\0\0bivpois-Rcode/.Rhistory+\xce/-JN\xd5PO\xca,+\xc8\xcf,\xd6+IL\xcaI\xd5\vR\xd7\xe4\xe5*\x86J\xe5\xe4\xea%\025`\b\xa5d\xa2\v楖\xe7%\xe6' Warning message: In install.packages("/home/p/Research/14_bivpois-Rcode.zip", repos = NULL, : installation of package ‘/home/p/Research/14_bivpois-Rcode.zip’ had non-zero exit status

    The R version is the 3.0.2 (2013-09-25) -- "Frisbee Sailing" and the OS is Linux Mint (UNIX).

    Why Do I get that error and what does it mean:

    installation of package ‘/home/p/Research/14_bivpois-Rcode.zip’ had non-zero exit status

    in R?

    You can find the package here and the file 14_bivpois-Rcode.zip is the source.

    I tried to install that locally and the path is the correct one.

    Any suggestion to install that package in UNIX?