Rgdal package installation on Amazon Linux AMI - r

I've installed geos, proj-4.8.0 and gdal-1.9.2, yet, after installing the R package rgeos, rgdal fails to install.
Here is a look at my home directory:
. . . and the error I get running install.packages("rgdal", type="source"):
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/mainstorage/michaeld/R/x86_64-redhat-linux-gnu-library/3.1/rgdal/libs/rgdal.so':
libgdal.so.1: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/mainstorage/michaeld/R/x86_64-redhat-linux-gnu-library/3.1/rgdal’
The downloaded source packages are in
‘/tmp/Rtmpt51iFG/downloaded_packages’
Warning message:
In install.packages("rgdal", type = "source") :
installation of package ‘rgdal’ had non-zero exit status
I infer that this error has something to do with a dependent library. . . but that is all I gather.
I should mention that running sudo yum install libgdal1 libgdal1-dev libgeos libgeos-dev as suggested here yields the following:
No package libgdal1 available.
No package libgdal1-dev available.
Package geos-3.4.2-1.3.amzn1.x86_64 already installed and latest version
No package libgeos-dev available.
So, perhaps the better question is how do I install these dev packages?
Thanks for any direction.

You probably need to update the dynamic library cache, using ldconfig as superuser.
Alternatively, rather than building the packages from source, you can enable the Extra Packages for Enterprise Linux (EPEL) repository.

Related

loading failed in installing R package fdaPDE from github

Good morning,
I am trying to install the R package fdaPDE from GitHub repository "NegriLuca/fdaPDE-manifold" via RStudio1.4, using the package devtools. My OS is Windows 10, I am using Rtools35 and R3.5.1. The package has to be compiled from source. I have typed the following:
install.packages('devtools')
library(devtools)
install_github("NegriLuca/fdaPDE-manifold")
and got the following:
[… I omit the long compilation part …]
** building package indices
** testing if installed package can be loaded
*** arch - i386
Error: package or namespace load failed for 'fdaPDE'inlibrary.dynam(lib, package, package.lib):
DLL 'fdaPDE' not found: maybe not installed for this architecture?
Errore: loading failed
Esecuzione interrotta
*** arch - x64
Error: package or namespace load failed for 'fdaPDE' in library.dynam(lib, package, package.lib):
DLL 'fdaPDE' not found: maybe not installed for this architecture?
Errore: loading failed
Esecuzione interrotta
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/Gianmaria/Documents/R/win-library/3.5/fdaPDE'
In R CMD INSTALL
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/GIANMA~1/AppData/Local/Temp/RtmpwDxgqJ/file466865be7d8c/fdaPDE_0.1-5.tar.gz’ had non-zero exit status
What can I do to fix this?
I have finally managed to install the package. What I did was the following:
-REMOVE previous installations (I had supposed that to be done automatically but it was not, and I had an older version installed) by typing in Rstudio
remove.packages("fdaPDE")
-In Windows cmd, after having downloaded the code from Github, type
"Path/to/Rfolder/R" CMD BUILD <path to folder fdaPDE>
"Path/to/Rfolder/R" CMD INSTALL -l <path name of the R library tree> <path name of the package to be installed>
Hope that this may be useful for other people who faces similar errors.

Installing ROracle (and the Oracle Instant Client?) on MacOS

I'm trying to install ROracle. Since ROracle requires the Oracle OCI libraries, I downloaded these files from the Oracle website: instantclient-basic-macos.x64-12.2.0.1.0, instantclient-sdk-macos.x64-12.2.0.1.0.zip. I put those files in ~/Library/Caches/Homebrew and install them using homebrew.
brew install instantclient-basic
brew install instantclient-sdk
The Oracle website also mentioned the need to set some environment variables, so I put this in my .bashrc file:
export LD_LIBRARY_PATH=/usr/local/Cellar/instantclient-basiclite/12.2.0.1.0/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/Cellar/instantclient-basiclite/12.2.0.1.0/lib:$DYLD_LIBRARY_PATH
export NLS_LANG=UTF8
But trying to install ROracle in R leads to this:
> install.packages("ROracle")
Installing package into ‘/usr/local/lib/R/3.4/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ROracle_1.3-1.tar.gz'
Content type 'application/x-gzip' length 308252 bytes (301 KB)
==================================================
downloaded 301 KB
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2017c.1.0/zoneinfo/America/Los_Angeles'
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: error: OCI libraries not found
ERROR: configuration failed for package ‘ROracle’
* removing ‘/usr/local/lib/R/3.4/site-library/ROracle’
Warning in install.packages :
installation of package ‘ROracle’ had non-zero exit status
R says it can't find the OCI libraries. Oracle's documentation has so far proven non-existent or worthless in resolving this issue, but I found a comment on the internet that seemed promising. So I wrote this into my .bashrc and ran it:
R CMD INSTALL --configure-args='--with-oci-lib=/usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib --with-oci-inc=/usr/local/Cellar/instantclient-sdk/12.2.0.1.0/lib/sdk/include' ROracle_1.3-1.tar.gz
With this result:
installing to /usr/local/lib/R/3.4/site-library/ROracle/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
****unable to load shared object '/usr/local/lib/R/3.4/site-
library/ROracle/libs/ROracle.so':
dlopen(/usr/local/lib/R/3.4/site-library/ROracle/libs/ROracle.so, 6): Symbol
not found: _ons_recvthread_clone_sb
Referenced from: /usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib/libons.dylib
Expected in: flat namespace
in /usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib/libons.dylib
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.4/site-library/ROracle’
So there's something wrong with libons.dylib? What am I supposed to do with that information?
The Instant Client 12.2 for macOS was patched. Get it from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html and unzip it, for example into ~/instantclient_12_2
I was able to install ROracle on macOS with:
brew install R
Update rpath in the library (using the correct version number for R):
install_name_tool -add_rpath ~/instantclient_12_2 /usr/local/Cellar/r/3.4.3/lib/R/bin/exec/R
Run 'R' and then:
install.packages("DBI")
Download ROracle_1.3-1.tar.gz from https://cran.r-project.org/web/packages/ROracle/index.html and install it:
R CMD INSTALL --configure-args='--with-oci-lib=/Users/cjones/instantclient_12_2 --with-oci-inc=/Users/cjones/instantclient_12_2/sdk/include' ROracle_1.3-1.tar.gz
A solution for that without -add_rpath can be found on Intall ROracle Package for Windows and Mac OS
I use R from Macports and I did:
cd /opt/local/Library/Frameworks/R.framework/Resources/lib
sudo ln -s ~/Applications/instantclient/libclntsh.dylib.12.1
sudo ln -s ~/Applications/instantclient/libclntshcore.dylib.12.1
sudo ln -s libclntsh.dylib.12.1 libclntsh.dylib
sudo ln -s libclntshcore.dylib.12.1 libclntshcore.dylib
I think only the link to libclntsh.dylib.12.1' is needed. But it does not harm to create the others as well. This way you do not need to runinstall_name_tool` after every upgrade to R.
After creating the links I was able to install ROracle using R CMD INSTALL

Installing GISTools R Package in DSX

I am trying to install the "GISTools" R package in my R Jupyter notebook in IBM's Data Science Experience (DSX) with the following command:
install.packages("GISTools", depend = T)
however, I get the following error message: Installing package into
‘/gpfs/global_fs01/sym_shared/YPProdSpark/user/s17c-9f3318fc11f06c-d37a4b9405b6/R/libs’
(as ‘lib’ is unspecified)
also installing the dependency ‘rgeos’
Warning message in install.packages("GISTools", depend = T):
“installation of package ‘rgeos’ had non-zero exit status”Warning message in install.packages("GISTools", depend = T):
“installation of package ‘GISTools’ had non-zero exit status”
When I try library(GISTools) command, I get the following error message:
Error in library(GISTools): there is no package called ‘GISTools’
Traceback:
1. library(GISTools)
2. stop(txt, domain = NA)
I have looked at the following links in particular (and several other threads on Stack Overflow) but have not been able to resolve my issue:
Cannot install R packages in Jupyter Notebook
conda - How to install R packages that are not available in "R-essentials"?
Please can someone help?
Thanks,
V
GISTools have dependency on R package rgeos.
Now installing rgeos need you to have GEOS installed.
https://cran.r-project.org/web/packages/rgeos/rgeos.pdf
I attempted to install GEOS on DSX, it seems that GEOS need sudo permissions to install which are not available on DSX as a user.
https://duntuk.com/how-install-geos-centos
"make[7]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/include/geos/algorithm/locate" || /bin/mkdir -p "/usr/local/include/geos/algorithm/locate"
/bin/mkdir: cannot create directory ‘/usr/local/include/geos’: Permission denied
make[7]: *** [install-geosHEADERS] Error 1"
You will need to rely on DSX Team to first install GEOS package installed and then you can install rgeos.
Please raise uservoice to get that installed so that you can install rgeos and then GISTools.
https://datascix.uservoice.com/
Hope that helps!!!
Thanks,
Charles.

R ubuntu xlsx package

I am trying to install xlsx package on Ubuntu in R in order to use a function allowing to insert links in R and then export them to Excel.
Having said that, I simply can't install the package.
Apparently it has to do wit rJava but I can't figure out a solution.
Any hint?
Here's the message I receive:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/lib/R/site-library/rJava /libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error : package ‘rJava’ could not be loaded
ERROR: lazy loading failed for package ‘xlsx’
* removing ‘/home/.../x86_64-pc-linux-gnu-library/3.2/xlsx’
Warning in install.packages :
installation of package ‘xlsx’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpsjilCH/downloaded_packages’
I'm reluctant to install Java on my own machine, but you could try installing a Java runtime environment:
sudo apt install default-jre
before trying again (perhaps starting by manually install rJava as #Bhas suggests).
Instead of a java-based solution though, why not try readxl which has no external dependencies:
install.packages("readxl")
(I would post this in a comment but I do not have enough reputation)
I agree with #Phil 's advice, but I'd add a small note: readxl is from the tidyverse family and has no external dependencies, but it is not able to export data in .xls/.xlsx format. Nevertheless, readxl's own webpage suggests other dependency-free packages to export data into Excel format, like for example openxlsx. You might want to check that out.
Still, perhaps you could try to set dependencies = TRUE in the install.packages() command.
In my experience you have to install java 11
sudo apt install default-jre
sudo apt install default-jdk
If java -version does not point to 11, use:
sudo ln -s /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/bin/java
Then,
sudo R CMD javareconf
In R:
install.packages("rJava")

R packages: RCurl and curl packages install failure on Linux

I hope you can help with this issue I have come across whilst installing RCurl and curl packages for R.
Rd warning: /tmp/RtmpOBkvFC/R.INSTALLd07e6c06faf4/RCurl/man/url.exists.Rd:5: missing file link ‘file.exists’
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/RCurl/libs/RCurl.so':
/lib64/libgssapi_krb5.so.2: symbol krb5int_buf_len, version krb5support_0_MIT not defined in file libkrb5support.so.0 with link time reference
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/RCurl’
The downloaded source packages are in
‘/tmp/RtmpX6poG4/downloaded_packages’
Warning message:
In install.packages(pkgs = pkgs, lib = lib, repos = repos, ...) :
installation of package ‘RCurl’ had non-zero exit status`
That looks like that you have different versions of libcurl.
One approch could be the following one (for your console):
wget https://cran.r-project.org/src/contrib/curl_0.9.7.tar.gz
R CMD INSTALL curl_0.9.7.tar.gz --no-test-load
ldd /home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/curl/libs/curl.so
Then you can use ldd libcurl.so to find all dependencies and shared libraries to this.
Perhaps you can find some errors and/or you have to create a new LD_LIBRARY_PATH.
Good Luck!
J_F

Resources