install packages error - r

Here is my annoying problem.When I am trying to install packages by:
install.packages("multicore")
I get the error:
error at if (nzchar(SHLIB_LIBADD)) SHLIB_LIBADD else character() : the length of parameter is zero
Here multicore is not the only package that I can not install.I have the same error for many other packages(but not all of the packages) such as Rcpp etc.
I am using debian jessie with R version 3.0.3 (2014-03-06) -- "Warm Puppy" .I have run into this problem for a while.And it is really annoying.Even if I use the R which compiled from the source code it still has the same problem.
Appreciate any suggestion!

Mixing package management is tricky and Debian tends to ignore it.
try instead
sudo apt-get install r-cran-multicore
which I found by going to Debian Packages and searching descriptions for multicore "GNU R"
You can check it is the package you want here.

Related

Cannot install any R package

I'm on Ubuntu 20.04. R version 4.0.2.
I've been using R for a long time and everything worked fine.
Today, when trying to install new packages i get this error:
** checking absolute paths in shared objects and dynamic libraries
readelf: symbol lookup error: readelf: undefined symbol: ctf_arc_bufopen, version LIBCTF_1.0
Error in system(paste("readelf -d", shQuote(l)), intern = TRUE) :
error in running command
I tried to delete and reinstall R and all the packages, but now the same thing happens also for packages that were previously installed. So i think that the problem is not caused by R itself.
I havent done any R update recently.
First of all, thank you very much Chris for hinting at the problem. It was actually ctf-suite related.
When doing grep libctf* it returned:
ii libctf0:amd64 2.35.1-1ubuntu1
amd64 Compact C Type Format library (runtime, BFD dependency)
So I tried:
sudo apt-get install libctf-nobfd0
and it actually solved the problem.
I managed to install all the needed packages.

R 3.5 package ‘lattice’ was installed by an R version with different internals

I updated R 3.4.4 to R 3.5.0 today. And my package cannot pass R CMD check anymore. It fails at checking whether package can be installed ... ERROR.
In another hand my package works, I can install it and use it as long as I don't check it.
The error is the following:
Error: package or namespace load failed for ‘sp’:
package ‘lattice’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
Error : package ‘sp’ could not be loaded
I tried to reinstall lattice these ways:
sudo apt-get --reinstall install r-cran-lattice
or
remove.packages("lattice", lib="~/R/x86_64-pc-linux-gnu-library/3.5")
install.package("lattice")
The package lattice is installed correctly in both cases. But it does not solve my problem. Also I ensured to have a single version of lattice removing either the r-cran one or the self compiled version. Nothing works.
Edit By the way I can do library(sp) or library(lattice) it works. But not with R CMD check
The error message tells you that the binary you are attempting to install comes from an insufficient / incompatible R version.
Two fixes:
Install from source as you did. After that check with AP <- available.packages() that you really only have one.
Use the correct binarie: read this README at CRAN and switch to Michael's 'R 3.5' repos. Many of us have been doing that for weeks.
Lastly, the r-sig-debian list is a friendly place for these questions and more. Subscribe first so that you can post.

Error: package or namespace load failed for 'RevoUtilsMath'

I'm getting a little bit crazy with this issue. I'm trying to install an R package using conda in my environment (python 2.7) in my home on a cluster (i.e. without root permissions). I firstly installed R in my env using:
conda install -c r r=3.4
Then:
conda install -c conda-forge python-igraph
(because igraph is required by my library of interest)
and finally:
conda install -c conda-forge r-diffusionmap
Unfortunately when I launch R the following message appears:
Error: package or namespace load failed for 'RevoUtilsMath': .onLoad
failed in loadNamespace() for 'RevoUtilsMath', details: call: NULL
error: Remove Microsoft R and then re-install. Be sure to select MKL
libraries as an install option.
During startup - Warning message:
package 'RevoUtils' was built under R version 3.4.3
What does it mean? How can I solve this?
Thank you in advance
I had this same issue after I installed some libraries (Rcpp included) in my root R, but not my conda environment (which screwed up conda). This would cause kernel death anytime a jupyter notebook running R was even opened.
The fix for me was:
Uninstall Anaconda3
Reinstall Anaconda3
Reinstall all the libraries I needed (mostly just Bioconductor in R)
A few other issues popped up, like package inconsistencies, but I dealt with those as described here.
All R packages on conda-forge (or Bioconda) are compiled against one single version or R for each new release branch (usually starting from patch 1, so 3.x.1, except for 3.4.3). This is due to ABI incompatibility problems.
Also note that defaults and conda-forge channels are (where) not binary compatible (although now they should be). And that since 2018 the default anaconda channel is distributing Microsoft R Open as default R, whether all packages from conda-forge should be preferably used with R from conda-forge.
You should be able to solve this issue by installing R using conda install -c conda-forge r-base.
the same error information for me when I open R for run code in ubuntu platform(18.4), and there is no other useful methods to solve it.My R version is 3.4.3.enter image description here

R unable to load dplyr

I'm running from Ubuntu 16, using R version 3.4.1. I have dplyr installed and can load it when either I am running from RStudio or when I sudo into R from the terminal. However, if I run R without root permission, I cannot load dplyr due to the following error:
Error: package or namespace load failed for ‘dplyr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '<user-directory>/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so':
<user-directory>/anaconda3/lib/R/bin/exec/../../lib/../.././libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by <user-directory>/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so)
(where above I've replaced the /home/MY_USER_NAME dir with <user-directory> for some mild anonymization). I've seen a couple posts that may be tangentially related, but none of those remedies worked for me.
I'm curious if the fix is something as simple as changing permissions or ownership of certain files, or if the issue is that the search for GLIBCXX_3.4.20 is directed into my anaconda3 directory (when not root?!)?
Thank you in advance for any insights!
Edit: This may be an issue from a more base level with my installation of R. Often I install packages using install.packages(...) within RStudio, but on occasion this results in an error that is overcome by installing with install.packages(...) after entering R as root. This was the case with both dplyr and Rcpp. I.e., the versions which I have just reinstalled were done so as
> sudo R
> install.packages( 'Rcpp', dependencies = T )
> install.packages( 'dplyr', dependencies = T )
Please make your question useful and understandable by stating how you installed these packages.
They come both from Ubuntu ie sudo apt-get install r-cran-dplyr will get a working version, and from CRAN ie install.r dplyr will too (here using my install.r from littler, use other wrappers to install.packages() at your leisure).
Sometimes your underlying libraries change so my first bet would be to simply reinstall Rcpp and then dplyr.
Your reference to /home suggests you installed from source, but as root. That is a bad idea. There a number of other questions answered here on the site about when/where/how apt-get may (or may not) be preferable so I don't need to repeat this.
Edit: In response to your edit:
Never ever do sudo R. You want to write to /usr/local/lib/R/site-library and for that you can 1.a) add yourself to the group owning that directory or 1.b) make it owned by your group if it is just you on that machine.
You could just do install.packages(c("Rcpp", "dplyr")) but you don't even need that as dplyr depends on Rcpp.
Why not use the prebuild package? Remove what you have (ie sudo R CMD REMOVE Rcpp and ditto for dplyr, then do sudo apt-get install r-cran-dplyr

Cannot install R packages in Jupyter Notebook

I am trying to run R code in Jupyter and the R Kernel was added. Most of the time, packages can be installed successfully. However, some of the packages, such as RCurl and ggmap, would got error while installing.
Example:
install.packages("RCurl")
Warning message in install.packages("RCurl"):
“installation of package ‘RCurl’ had non-zero exit status”Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
What should I do?
Try to specify CRAN as repository in your install.packages statement when installing RCurl and ggmap. For example:
install.packages("RCurl", repos='http://cran.us.r-project.org')
This Stack Overflow post on installing R packages through Anaconda/Jupyter beyond those included in R essential provides more detail.
(Side note: I had encountered the same issue when trying to install R packages on computer clusters. This solution worked for me.)
use conda comment:
conda install r-RCurl
I kept getting the non-zero exit status when trying to install packages with Jupyter notebook with R kernel and was failing because of multiple dependencies when wanting to install a package. I am not an expert in any of these so please forgive me if I make an error in explaining or if it is a non-issue for you but please feel free to comment to clear things out. I just want to share my success story so hopefully it can help someone else: I am working on a MacBook Pro. Here are the information I get when I run R.version() on my jupyter notebook with R kernel:
$platform 'x86_64-conda_cos6-linux-gnu'
$arch 'x86_64'
$os 'linux-gnu'
$system 'x86_64, linux-gnu'
$language 'R'
$version.string 'R version 3.6.1 (2019-07-05)'
These are the steps to take to fix the issue:
Go to https://anaconda.org/
Search the package name that you are trying to install
Copy the one line that is given to install the package, it should be something like:
Conda install -c r r-caret #conda install -c r r-package_name
NOTE: sometimes during installing packages, you’re asked whether or not you want to continue, so add --y at the end of the above statement to continue, so something like this
Conda install -c r r-caret --y
(I will always add it just to be on the safe side)
Click on the new launcher (+ icon) to create a new notebook with PySpark (once opened it has .ipynp extension)
On the first cell paste the copied line from step 2 and run
Once done, restart the kernel on the current notebook
Restart the kernel on your other notebook with R kernel
Run library(package_name) on your notebook with R kernel (e.x. library(caret))
install.packages("Hmisc", .libPaths(), repos='http://cran.us.r-project.org')
This command will install the packagae in the conda
"/home/user/anaconda3/lib/R/library" and use the cran r repository as source.
Add path in Anaconda
As per this answer,
one can also add additional paths in anaconda to load libraries from (for eg., the location where R studio saves the user-installed packages) with
.libPaths( c( .libPaths(), "~/userLibrary") )
For example, the following worked for me:
In Anaconda :
.libPaths( c( .libPaths(), "C:\Users\name\Documents\R\win-library\3.5") )
When I tried to add anaconda's library path to RStudio, it resulted in errors (The procedure entry point MARK_NOT_MUTABLE could not be located in the dynamic link library << arose 4 times in succession) after installation of a package, though the package seemed to load.
Replace name with your local user folder name
Add/change path in RStudio
A useful link to make changes in default user-installed library paths :
https://www.accelebrate.com/library/how-to-articles/r-rstudio-library
To find out where a package has been installed:
find.package('package_name')
The directions nobody else supplied worked for me, but I found this guide, and it worked. Spent way too much time trying all these when I just needed a few simple commands. https://developers.refinitiv.com/en/article-catalog/article/setup-jupyter-notebook-r
I already had R and python installed, so I skipped to step 3. The only seems to mention windows, but it worked for me on mac as well. After following them I was able to install the packages using install.packages("dplyr", repos = "http://cran.us.r-project.org") in a cell in jupyter.
You have to create a directory in which your package will be and do for eg:
install.packages('ggplot2',loc='your directory')
First Step: You can install the IRkernel packages by running the following command in an R console:install.packages('IRkernel')
Second Step: You will have to make Jupyter see the newly installed R kernel by installing a kernel spec. To install system-wide, set user to False in the installspec command IRkernel::installspec(user = FALSE)
Setup Jupyter Notebook for R

Resources