Dependency error when install ggplot in R - 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.

Related

Can't install rtracklayer on CentOS 7 and R 4

I have tried installing the rtracklayer package using Bioconductor on R 4.0.2 and CentOS 7 without success. This is the error that I get:
installing to ~/bin/R/lib64/R/library/00LOCK-rtracklayer/00new/rtracklayer/libs
** R
** data
** demo
** inst
** byte-compile and prepare package for lazy loading
Creating a generic function for ‘offset’ from package ‘stats’ in package ‘rtracklayer’
Creating a generic function from function ‘uri’ in package ‘rtracklayer’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rtracklayer’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '~/bin/R/lib64/R/library/00LOCK-rtracklayer/00new/rtracklayer/libs/rtracklayer.so':
~/bin/R/lib64/R/library/00LOCK-rtracklayer/00new/rtracklayer/libs/rtracklayer.so: undefined symbol: CRYPTO_set_locking_callback
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘~/bin/R/lib64/R/library/rtracklayer’
The downloaded source packages are in
‘/tmp/Rtmpet2cyn/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages(...) :
installation of package ‘rtracklayer’ had non-zero exit status
I haven't been able to fix this. Note: I've changed the absolute address of my home folder to "~"

New to R Studio. library(devtools) not loading. Error: package or namespace load failed for ‘devtools’. Is there a way out?

I am new to RStudio.
I am trying to load devtools so that I can install packages from github
So basically what I am trying to do is:
install.packages("devtools")
load(devtools)
install_github("author/package")
Ideally these three steps should have gone through without a hitch. But this is what happened.
library(devtools)
Error: package or namespace load failed for ‘devtools’:
.onLoad failed in loadNamespace() for 'pkgload', details:
call: NULL
error: package ‘backports’ does not have a namespace
What do I do? I am completely new to this.
Here's the whole console
> install.packages("devtools")
Installing package into ‘C:/Users/Rohan Gopakumar/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
devtools 2.3.0 2.3.1 FALSE
installing the source package ‘devtools’
trying URL 'https://cran.rstudio.com/src/contrib/devtools_2.3.1.tar.gz'
Content type 'application/x-gzip' length 373604 bytes (364 KB)
downloaded 364 KB
* installing *source* package 'devtools' ...
** package 'devtools' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error: .onLoad failed in loadNamespace() for 'pkgload', details:
call: NULL
error: package 'backports' does not have a namespace
Execution halted
ERROR: lazy loading failed for package 'devtools'
* removing 'C:/Users/Rohan Gopakumar/Documents/R/win-library/4.0/devtools'
* restoring previous 'C:/Users/Rohan Gopakumar/Documents/R/win-library/4.0/devtools'
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\Rohan Gopakumar\AppData\Local\Temp\Rtmpasaxsp\downloaded_packages’
> library(devtools)
Error: package or namespace load failed for ‘devtools’:
.onLoad failed in loadNamespace() for 'pkgload', details:
call: NULL
error: package ‘backports’ does not have a namespace

How to fix the installation error with 'car' package

I am getting the below error while trying to install the 'car' package in R. Is there anything wrong I am doing here?
trying URL 'https://cran.rstudio.com/src/contrib/car_3.0-2.tar.gz'
Content type 'application/x-gzip' length 447952 bytes (437 KB)
downloaded 437 KB
* installing source package 'car' ...
** package 'car' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
Warning: package 'carData' was built under R version 3.5.2
Warning in fun(libname, pkgname) :
bytecode version mismatch; using eval
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/33904/Documents/R/win-library/3.3/data.table/libs/x64/datatable.dll':
LoadLibrary failure: The specified procedure could not be found.
ERROR: lazy loading failed for package 'car'
* removing 'C:/Users/33904/Documents/R/win-library/3.3/car'
* restoring previous 'C:/Users/33904/Documents/R/win-library/3.3/car'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\33904\Documents\R\win-library\3.3" C:\Users\33904\AppData\Local\Temp\Rtmpm23nOy/downloaded_packages/car_3.0-2.tar.gz' had status 1
Warning in install.packages :
installation of package ‘car’ had non-zero exit status

Error in installing packages 'stringr', 'reshape2', and 'ggplot2', and 'rattle' on mac

I am not a Mac user, but I am trying to help some students to install rattle on their Mac systems. I suggest them to follow zhiyzuo post, which is based on Yihui’s comment. But they get the following errors, although 'brew' is installed on their system:
* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error in library.dynam(lib, package, package.lib) :
shared object ‘stringi.so’ not found
ERROR: lazy loading failed for package ‘stringr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/stringr’
Warning in install.packages :
installation of package ‘stringr’ had non-zero exit status
ERROR: dependency ‘stringr’ is not available for package ‘reshape2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/reshape2’
Warning in install.packages :
installation of package ‘reshape2’ had non-zero exit status
ERROR: dependency ‘reshape2’ is not available for package ‘ggplot2’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
ERROR: dependencies ‘ggplot2’, ‘stringr’ are not available for package ‘rattle’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rattle’
Warning in install.packages :
installation of package ‘rattle’ had non-zero exit status

How to get my installed lib recognized by R

To put it simply, my R could not recognize my "libssl.so.1.0.0" installed.
Wondering any one has any suggestion.
For the details:
I was trying to install a R package "devtools",
but had one issue.
install.packages("devtools")
...
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r/libs/git2r.so':
libssl.so.1.0.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r’
ERROR: dependency ‘openssl’ is not available for package ‘httr’
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/httr’
ERROR: dependencies ‘httr’, ‘git2r’ are not available for package ‘devtools’
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/devtools’
...
it seemed that "libssl.so.1.0.0" is required.
But when I checked which "openssl" I am using:
$ which openssl
~/.anaconda/bin/openssl
$ ldd ~/.anaconda/bin/openssl
linux-vdso.so.1 => (0x00007fffb0de8000)
libssl.so.1.0.0 => /somewhere/Jun/.anaconda/bin/../lib/libssl.so.1.0.0 (0x00002b0618dca000)
libcrypto.so.1.0.0 => /somewhere/Jun/.anaconda/bin/../lib/libcrypto.so.1.0.0 (0x00002b0619041000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003cae000000)
libc.so.6 => /lib64/libc.so.6 (0x0000003cad800000)
/lib64/ld-linux-x86-64.so.2 (0x0000003cad400000)
So it seems to me that "libssl.so.1.0.0" was there, the problem is that R could not find it.
Any suggestion to solve this?
Update:
Another tempt (following 42-'s kind suggestion in the comments)
Adding dependencies=TRUE for "install.packages" command
install.packages("devtools", dependencies=TRUE)
1: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘openssl’ had non-zero exit status
2: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘git2r’ had non-zero exit status
3: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘httr’ had non-zero exit status
4: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘covr’ had non-zero exit status
5: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘gmailr’ had non-zero exit status
6: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘devtools’ had non-zero exit status
7: In install.packages("devtools", dependencies = TRUE) :
installation of package ‘lintr’ had non-zero exit status
tried to install "git2r" first:
install.packages("git2r",dependencies=TRUE)
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘summary’ from package ‘base’ in package ‘git2r’
Creating a generic function for ‘diff’ from package ‘base’ in package ‘git2r’
Creating a generic function for ‘merge’ from package ‘base’ in package ‘git2r’
Creating a generic function for ‘plot’ from package ‘graphics’ in package ‘git2r’
Creating a generic function for ‘head’ from package ‘utils’ in package ‘git2r’
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r/libs/git2r.so':
libssl.so.1.0.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r’
The downloaded source packages are in
‘/tmp/Rtmp55IwjF/downloaded_packages’
Warning message:
In install.packages("git2r", dependencies = TRUE) :
installation of package ‘git2r’ had non-zero exit status

Resources