Cannot install tmap tmaptools, Error unable to load shared object lwgeom.so': libproj.so.19 - r

I cannot install the R packages tmaptools and tmap in ubuntu linux, I have followed the instructions in
https://geocompr.github.io/post/2020/installing-r-spatial-ubuntu/
I installed sf and checked:
library(sf)
Linking to GEOS 3.10.1, GDAL 3.4.0, PROJ 8.2.0; sf_use_s2() is TRUE
Warning messages:
1: replacing previous import ‘lifecycle::last_warnings’ by ‘rlang::last_warnings’ when loading ‘pillar’
2: replacing previous import ‘lifecycle::last_warnings’ by ‘rlang::last_warnings’ when loading ‘tibble’
When I try to instal tmaptools the following error appears
> install.packages("tmaptools")
Installing package into ‘/home/leonardo/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/tmaptools_3.1-1.tar.gz'
Content type 'application/x-gzip' length 40116 bytes (39 KB)
==================================================
downloaded 39 KB
* installing *source* package ‘tmaptools’ ...
** package ‘tmaptools’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** byte-compile and prepare package for lazy loading
Warning: replacing previous import ‘lifecycle::last_warnings’ by ‘rlang::last_warnings’ when loading ‘pillar’
Warning: replacing previous import ‘lifecycle::last_warnings’ by ‘rlang::last_warnings’ when loading ‘tibble’
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/leonardo/R/x86_64-pc-linux-gnu-library/4.1/lwgeom/libs/lwgeom.so':
libproj.so.19: cannot open shared object file: No such file or directory
Calls: <Anonymous> ... asNamespace -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘tmaptools’
* removing ‘/home/leonardo/R/x86_64-pc-linux-gnu-library/4.1/tmaptools’
Warning in install.packages :
installation of package ‘tmaptools’ had non-zero exit status
I have already removed the package and installed it again, but I always get the same error.

Browsing the tmap issues on github I found the answer:
install lwgeom package, so
install.packages("lwgeom")
Solved the problem.

Related

I'm getting an error when installing brms R package

I'm trying to install "brms" package but keep getting an error.
First, I installed "brms" package, and then call the package from the library.
I'm getting the following error message. "Error in library(brms) : there is no package called ‘brms’
Can someone help me?
install.packages("brms")
Installing package into ‘C:/Users/.......’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is
later:
binary source needs_compilation
brms 2.17.0 2.18.0 FALSE
installing the source package ‘brms’
trying URL 'https://cran.rstudio.com/src/contrib/brms_2.18.0.tar.gz'
Content type 'application/x-gzip' length 4486548 bytes (4.3 MB)
downloaded 4.3 MB
* installing *source* package 'brms' ...
** package 'brms' successfully unpacked and MD5 sums checked
** using staged installation
** R
Warning: namespace 'brms' is not available and has been replaced
by .GlobalEnv when processing object 'brmsfit_example1'
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Warning message:
package 'Rcpp' was built under R version 4.0.5
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called 'Brobdingnag'
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package 'brms'
* removing 'C:/Users/....'
Warning in install.packages :
installation of package ‘brms’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\....\downloaded_packages’
library(brms)
Error in library(brms) : there is no package called ‘brms’
In that case, you probably didn't let the 'install' step finish. That package has a lot of dependencies. Try install.packages("brms") again and wait for it to finish.

Dependency error when install ggplot in R

When I try to install ggplot with this code
install.packages("png")
install.packages("RgoogleMaps")
install.packages("ggmap")
library(ggmap)
It returns error
installing to /usr/local/Cellar/r/4.2.2/lib/R/library/00LOCK-png/00new/png/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 from temporary location
Error: package or namespace load failed for ‘png’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/Cellar/r/4.2.2/lib/R/library/00LOCK-png/00new/png/libs/png.so':
dlopen(/usr/local/Cellar/r/4.2.2/lib/R/library/00LOCK-png/00new/png/libs/png.so, 6): Library not loaded: #rpath/libz.1.dylib
Referenced from: /usr/local/Cellar/r/4.2.2/lib/R/library/00LOCK-png/00new/png/libs/png.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/Cellar/r/4.2.2/lib/R/library/png’
Warning in install.packages :
installation of package ‘png’ had non-zero exit status
ERROR: dependency ‘png’ is not available for package ‘RgoogleMaps’
* removing ‘/usr/local/Cellar/r/4.2.2/lib/R/library/RgoogleMaps’
Warning in install.packages :
installation of package ‘RgoogleMaps’ had non-zero exit status
ERROR: dependencies ‘RgoogleMaps’, ‘png’ are not available for package ‘ggmap’
* removing ‘/usr/local/Cellar/r/4.2.2/lib/R/library/ggmap’
Warning in install.packages :
installation of package ‘ggmap’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/fd/7vyffy191_l3j6fhyqbvsn0r0000gn/T/RtmptKSXHF/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Error in library(ggmap) : there is no package called ‘ggmap’
I am installing all the dependencies that the error says are missing. By adding the install packages before installing the ggmap itself.

Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding

I need to install the “lifecycle” package in order to run an R code but I’m getting the error below.
I’ve already uninstalled and re-installed both RTools and R for Windows with no luck.
The WARNING message states to install the appropriate version of Rtools before proceeding – how do I find out what the ‘appropriate’ version that I would need to install?
>install.packages("lifecycle")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘c:/RLibrary’
(as ‘lib’ is unspecified)
also installing the dependency ‘cli’
There are binary versions available but the source versions
are later:
binary source needs_compilation
cli 2.5.0 3.4.1 TRUE
lifecycle 1.0.0 1.0.3 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/cli_2.5.0.zip'
Content type 'application/zip' length 534931 bytes (522 KB)
downloaded 522 KB
package ‘cli’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\X\AppData\Local\Temp\RtmpM95qM9\downloaded_packages
installing the source package ‘lifecycle’
trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.3.tar.gz'
Content type 'application/x-gzip' length 106854 bytes (104 KB)
downloaded 104 KB
* installing *source* package 'lifecycle' ...
** package 'lifecycle' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'c:/RLibrary/rlang/libs/x64/rlang.dll':
LoadLibrary failure: The specified procedure could not be found.
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load -> inDL
Execution halted
ERROR: lazy loading failed for package 'lifecycle'
* removing 'c:/RLibrary/lifecycle'
Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status

CentOS install R package RLumShiny failed

I tried to install the shiny related package RLumShiny on the server.
System Version: CentOS Linux release 8.1.1911 (Core)
I tried to use :
install.packages("RLumShiny")
Some errors were returned. But I can't find these errors now.
And then i tired to use :
wget https://cran.r-project.org/bin/macosx/contrib/4.1/RLumShiny_0.2.2.tgz
R CMD INSTALL RLumShiny_0.2.2.tgz
R
library("RLumShiny")
The server reported an error:
>library(RLumShiny)
Error: package or namespace load failed for ‘RLumShiny’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/shiny/R/x86_64-redhat-linux-gnu-library/4.1/terra/libs/terra.so':
/home/shiny/R/x86_64-redhat-linux-gnu-library/4.1/terra/libs/terra.so: invalid ELF header
Then i tried :
>install.packages("RLumShiny")
Installing package into ‘/home/shiny/R/x86_64-redhat-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
try open URL'https://mirror-hk.koddos.net/CRAN/src/contrib/RLumShiny_0.2.2.tar.gz'
Content type 'application/x-gzip' length 448539 bytes (438 KB)
==================================================
downloaded 438 KB
installing *source* package ‘RLumShiny’ ...
package ‘RLumShiny’ successfully unpacked and MD5 sums checked
using staged installation
R
inst
byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/shiny/R/x86_64-redhat-linux-gnu-library/4.1/terra/libs/terra.so':
/home/shiny/R/x86_64-redhat-linux-gnu-library/4.1/terra/libs/terra.so: invalid ELF header
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘RLumShiny’
* removing ‘/home/shiny/R/x86_64-redhat-linux-gnu-library/4.1/RLumShiny’
* restoring previous ‘/home/shiny/R/x86_64-redhat-linux-gnu-library/4.1/RLumShiny’
The downloaded source packages are in
‘/tmp/RtmpZxd0sL/downloaded_packages’
Warning message:
In install.packages("RLumShiny") :
installation of package ‘RLumShiny’ had non-zero exit status
How can this be fixed?
The problem is clearly with the terra package. So the way to fix it would be to (re-) install that package first; perhaps after installing its system requirements (see the repo) perhaps with
sudo dnf install gdal-devel proj-devel geos-devel sqlite-devel

Not able to install RWeka

I am facing issues while installing the RWeka package. I tried installing rJava but even that is not being installed, can someone help here with the issue? You can follow the code for the error message
> install.packages("RWeka")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/1911120/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
RWeka 0.4-42 0.4-43 FALSE
installing the source package ‘RWeka’
trying URL 'https://cran.rstudio.com/src/contrib/RWeka_0.4-43.tar.gz'
Content type 'application/x-gzip' length 451318 bytes (440 KB)
downloaded 440 KB
* installing *source* package 'RWeka' ...
** package 'RWeka' successfully unpacked and MD5 sums checked
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** R
** inst
** byte-compile and prepare package for lazy loading
Error: .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Execution halted
ERROR: lazy loading failed for package 'RWeka'
* removing 'C:/Users/1911120/Documents/R/win-library/3.6/RWeka'
Warning in install.packages :
installation of package ‘RWeka’ had non-zero exit status

Resources