Some Packages not Running on R Version 1.0.153 [duplicate] - r

I had everything working with R and RStudio, but then I moved the folders when cleaning up my computer directories & files. Now I'm getting the error message below.
Should R and RStudio be installed under Program Files or Program Files (x86)? Should I have two libPaths?
install.packages("C:/Users/kevin/Downloads/fpp_0.5.zip", repos = NULL)
## Warning in install.packages :
## package ‘C:/Users/kevin/Downloads/fpp_0.5.zip’
## is not available (for R version 3.0.0)
## Installing package into ‘C:/Users/kevin/Documents/R/win-library/3.0’
## (as ‘lib’ is unspecified)
## package ‘fpp’ successfully unpacked and MD5 sums checked
library("fpp", lib.loc="C:/Users/kevin/Documents/R/win-library/3.0")
Loading required package: forecast
## Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
## there is no package called ‘colorspace’
## Error: package ‘forecast’ could not be loaded

When you install the package using the RStudio package installer or directly from CRAN, it doesn't install the dependencies ("fracdiff", "Rcpp", "RcppArmadillo" and "colorspace") and hence, R keeps throwing the load namespace error. Installing the package through, automatically installs all the dependencies and solves this problem.
install.packages("forecast",
repos = c("http://rstudio.org/_packages",
"http://cran.rstudio.com"))

The last time I encountered a very similar problem, I used this code which I got somewhere:
install.packages("package's name", repos=c("http://rstudio.org/_packages", "http://cran.rstudio.com"))
simply put your package's name in the quotation marks.
Hope this helps.

Use this:
install.packages("colorspace", dependencies = TRUE)

I ran into this problem. It turned out that my .Rprofile had calls to a package that was not installed. Removing these lines allowed installation to proceed normally.

I got this error while installing the library 'tidyverse'. Removed the error by upgrading R from v3.4 to v3.6

Related

Truble loading 'Hmisc' [duplicate]

I'm unable to load the car package in R. I tried reinstalling using
install.packages("car",dependencies=TRUE)
both from R and RStudio. I tried installing quantreg as advised in another post and then installing it again. Installation appears to be successful, but simply can't load the program.
Here's the complete error:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘pbkrtest’
In addition: Warning message: package ‘car’ was built under R version 3.2.3
Error: package or namespace load failed for ‘car’
This was just bumped to the homepage by Community. I can't take credit for the answer, but to give it a real non-comment answer:
You should upgrade R first. Then run update.packages(checkBuilt = TRUE). Finally, try again install.packages("car", dependencies=TRUE). If it doesn't work, try to install package pbkrtest first. - user3710546
Given that the current version of R at the time the question was posted was 3.2.3, I think that was a good answer.
I got the same error. (I am using R 3.2.2) Please perform the following steps in sequence (after that try to activate installed caret package):
install.packages("lme4", repos="http://cran.rstudio.com/",type = "binary", dependencies=TRUE)
install.packages("nlme", repos="http://cran.rstudio.com/",type = "binary", dependencies=TRUE)
packageurl <- "https://cran.r-project.org/src/contrib/Archive/pbkrtest/pbkrtest_0.4-4.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
No need to upgrade R. I am still using R 3.2.2. I performed these steps and it worked for me.

Loading ggplot2 throwing the Error: package or namespace load failed .... there is no package called ‘colorspace’

I'm trying to run a different package that's dependent on ggplot2. When I load ggplot2 it gives me the error:
library(ggplot2) Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘colorspace’
I tried to install colorspace and I got this lovely error:
install.packages("colorspace") ERROR: compilation failed for package ‘colorspace’ Warning in install.packages : installation of package ‘colorspace’ had non-zero exit status'
So I tried installing it after downloading it from http://cran.r-project.org/web/packages/colorspace/index.html.
And that still didn't work.
I've also tried closing everything down and reinstalling ggplot2.
I updated R to
`R version 4.0.5 (2021-03-31) -- "Shake and Throw"
this morning.
Are you in windows, Mac or Linux? For windows users it’s necessary to install Rtools which deals with installing packages from binary. Mac and Linux users should not have this issue.
I have had the same problem today updating my R from 3.6.1 to 4.1 and this worked for me:
install.packages("colorspace")
and when R asks
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)
type no

Installing missing dependencies in an R package

I'm distributing an R package that requires other packages. If any are missing I get (for example) the following error:
library(whSample)
Error: package or namespace load failed for ‘whSample’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘dplyr’
I have code to check and install dependencies in the whSample package, but R fails before it gets to it when it sees the import(dplyr) in NAMESPACE. Here's the first block of code when the package function is called:
is_installed <- function(mypkg) is.element(mypkg, installed.packages()[,1])
whInstall <- function(pkgNames){
for(pkg in pkgNames){
if(!is_installed(pkg)){
install.packages(pkg, repos="http://lib.stat.cmu.edu/R/CRAN")
}
suppressMessages(suppressWarnings(
library(pkg, character.only=T, quietly=T, verbose=F)))
}
}
whInstall(c("magrittr","tools","purrr","openxlsx","data.table","dplyr","glue"))```
How can I get R to do these checks without running afoul of NAMESPACE?
A short answer is that you can ask people to install with
devtools::install_local("your-package.tar.gz")
What's happening behind the scene is that install.packages ignores the dependencies option when installing from a local file. It somehow assumes that the repository from which your are installing the package should also have the dependent packages. But for local files there is no repository, hence no dependency handling occurs.
When you install the package from a local file, install is going to search for dependencies on the same local path... and won't find them.
To get the CRAN dependecies automatically installed, you can use :
install.packages("devtools")
devtools::install_local("MypackageName.zip")

Error while installing package kableExtra in R

I am trying to install kableExtra and get the following errors:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]) :
there is no package called 'hms'
ERROR: lazy loading failed for package 'kableExtra'
*removing 'C:/Users/Tim/Documents/R/win-library/3.2/kableExtra'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.5/bin/x64/R" CMD INSTALL -l "C:\Users\Tim\Documents\R\win-library\3.2"
C:\Users\Tim\AppData\Local\Temp\RtmpUJQfwD/downloaded_packages/kableExtra_0.9.0.
tar.gz' had status 1
Warning in install.packages :
installation of package ‘kableExtra’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\Tim\AppData\Local\Temp\RtmpUJQfwD\downloaded_packages’
How can I solve my problem? Thanks in advance!
it seems kableExtra depends on the package "hms" so try install it before with:
install.packages("hms")
or via rstudio interface:
packages -> install
and type in "hms"
also try this command:
install.packages("kableExtra", dependencies = TRUE)
If there appear problems like installing rlang or something similar, there is no general solution for this. You can try to (re)install rtools. Sometimes there are missing parts of r installations. My guess if R can't install a dependencie is, that some library or tools of the R environment are missing or wrongly installed which have to be detected.
You have a trouble with the dependency with the package "hms". I have not got how you are installing the r package, but you can either install it first and then try it again or start the installation with the option of download and install all required dependencies, in the second option you need to be online and allow the package manager to intall what is required.
Here is how it looks in RGui. I guess your are not using RGui.

lib unspecified & Error in loadNamespace

I had everything working with R and RStudio, but then I moved the folders when cleaning up my computer directories & files. Now I'm getting the error message below.
Should R and RStudio be installed under Program Files or Program Files (x86)? Should I have two libPaths?
install.packages("C:/Users/kevin/Downloads/fpp_0.5.zip", repos = NULL)
## Warning in install.packages :
## package ‘C:/Users/kevin/Downloads/fpp_0.5.zip’
## is not available (for R version 3.0.0)
## Installing package into ‘C:/Users/kevin/Documents/R/win-library/3.0’
## (as ‘lib’ is unspecified)
## package ‘fpp’ successfully unpacked and MD5 sums checked
library("fpp", lib.loc="C:/Users/kevin/Documents/R/win-library/3.0")
Loading required package: forecast
## Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
## there is no package called ‘colorspace’
## Error: package ‘forecast’ could not be loaded
When you install the package using the RStudio package installer or directly from CRAN, it doesn't install the dependencies ("fracdiff", "Rcpp", "RcppArmadillo" and "colorspace") and hence, R keeps throwing the load namespace error. Installing the package through, automatically installs all the dependencies and solves this problem.
install.packages("forecast",
repos = c("http://rstudio.org/_packages",
"http://cran.rstudio.com"))
The last time I encountered a very similar problem, I used this code which I got somewhere:
install.packages("package's name", repos=c("http://rstudio.org/_packages", "http://cran.rstudio.com"))
simply put your package's name in the quotation marks.
Hope this helps.
Use this:
install.packages("colorspace", dependencies = TRUE)
I ran into this problem. It turned out that my .Rprofile had calls to a package that was not installed. Removing these lines allowed installation to proceed normally.
I got this error while installing the library 'tidyverse'. Removed the error by upgrading R from v3.4 to v3.6

Resources