Error message: loadNamespace(name): there is no package called ‘yaml’ [duplicate] - r

I am not able to open install the ggplot2 and data.table packages.
It gives me the following error (example for ggplot2)
> library(ggplot2)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘ggplot2’
I was able to work fine with these 2 packages before I closed my R session. Now it shows me this error each time I try to run it.
I have also tried to remove and re-install it, but without success.
remove.packages(c("ggplot2", "data.table"))
install.packages('ggplot2', dep = TRUE)
install.packages('data.table', dep = TRUE)
I am not sure what's wrong

This solved the issue:
remove.packages(c("ggplot2", "data.table"))
install.packages('Rcpp', dependencies = TRUE)
install.packages('ggplot2', dependencies = TRUE)
install.packages('data.table', dependencies = TRUE)

After a wild goose chase with tons of Google searches and burteforce attempts, I think I found how to solve this problem.
Steps undertaken to solve the problem:
Uninstall R
Reinstall R
Install ggplot with the dependencies argument to install.packages set to TRUE
install.packages("ggplot2",dependencies = TRUE)
The above step still does NOT include the Rcpp dependency so that has to be manually installed using the following command
install.packages("Rcpp")
However, while the above command successfully downloads Rcpp, for some reason, it fails to explode the ZIP file and install it in my R's library folder citing the following error:
package ‘Rcpp’ successfully unpacked and MD5 sums checked Warning in
install.packages : unable to move temporary installation
‘C:\Root_Prgs\Data_Science_SW\R\R-3.2.3\library\file27b8ef47b6d\Rcpp’
to ‘C:\Root_Prgs\Data_Science_SW\R\R-3.2.3\library\Rcpp’
The downloaded binary packages are in
C:\Users\MY_USER_ID\AppData\Local\Temp\Rtmp25XQ0S\downloaded_packages
Note that the above output says "Warning" but actually, it is an indication of failure to install the Rcpp package successfully within the repository. I then used the Tools-->Install packages--> From ZIP file and pointed to the location of the "downloaded binary packages" in the message above -
C:\Users\MY_USER_ID\AppData\Local\Temp\Rtmp25XQ0S\downloaded_packages\Rcpp_0.12.3.zip
This led to successful installation of Rcpp in my R\R-3.2.3\library folder, thereby ensuring that Rcpp is now available when I attempt to load the library for ggplot2. I could not do this step in the past because my previous installation of R would throw error stating that Rcpp cannot be imported. However, the same command worked after I uninstalled and reinstalled R, which is ODD.
install.packages("C:/Users/MY_USER_ID/AppData/Local/Temp/Rtmp25XQ0S/downloaded_packages/Rcpp_0.12.3.zip", repos = NULL, type = "win.binary")
package ‘Rcpp’ successfully unpacked and MD5 sums checked`
I was finally able to load the ggplot2 library successfully.
library(ggplot2)

Faced same issue and solved by :
remove.packages("ggplot2")
install.packages('ggplot2', dependencies = TRUE)

I also faced the same problem and
remove.packages(c("ggplot2", "data.table"))
install.packages('Rcpp', dependencies = TRUE)
install.packages('ggplot2', dependencies = TRUE)
these commands did not work for me. What I found was that it was showing a warning message that it could not move temporary installation C:\Users\User_name\Documents\R\win-library\3.3\abcd1234\Rcpp to C:\Users\User_name\Documents\R\win-library\3.3\Rcpp.
I downloaded the Rcpp zip file from the link given and unziped it and copied it inside C:\Users\User_name\Documents\R\win-library\3.3 and then
library(Rcpp)
library(ggplot2)
worked. I did not have to uninstall R. Hope this helps.

when you see
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)
answer no

Try this:
install.packages('Rcpp')
install.packages('ggplot2')
install.packages('data.table')

I had the same problem with the package "tidyverse". I solved the problem with
1. uninstalling the package "Rcpp" and "tidyverse"
2. reinstalling "Rcpp" and answering the following questions during the installation process:
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)
with
no
reinstalling "tidyverse".

I tried the steps mentioned in the earlier posts but without any success. However, what worked for me was uninstalling R completely and then deleting the R folder which files in the documents folder, so basically everything do with R except the scripts and work spaces I had saved. I then reinstalled R and ran
remove.packages(c("ggplot2", "data.table"))
install.packages('Rcpp', dependencies = TRUE)
install.packages('ggplot2', dependencies = TRUE)
install.packages('data.table', dependencies = TRUE)
This rather crude method somehow worked for me.

I tried all the listed solutions above but nothing worked.
This is what worked for me.
Look at the complete error message which you get when you use library(ggplot2).
It lists a couple of packages which are missing or have errors.
Uninstall and reinstall them.
ggplot should work now with a warning for version.

These steps work for me:
Download the Rcpp manually from WebSite
(https://cran.r-project.org/web/packages/Rcpp/index.html)
unzip the folder/files to "Rcpp" folder
Locate the "library" folder under R install directory Ex:
C:\R\R-3.3.1\library
Copy the "Rcpp" folder to Library folder.
Good to go!!!
library(Rcpp)
library(ggplot2)

For me, i had to uninstall R from brew brew uninstall --force R and then head over to the R website and download and install it from there.

I had this same problem, but when running in a jupyter R notebook in an Anaconda environment.
The problem presented in such a way that any R notebook opened would instantly die and would not allow cell execution. The error would show up with each failed automated attempt to start the kernel:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
To solve this, I ran as admin/sudo: conda install -c r r-rcpp, restarted the kernel, and everything was back to normal.

Sorry for joining the party late, You can install any package in RStudio by downloading the zip file from the CRAN website and running the below snippet in the console,
install.packages('~/Downloads/Rcpp_1.0.8.tgz', repos = NULL, type = 'source')

Related

R3.5.0 and data.tables not working

edited 2018-04-26: Changed title as per comments, this is a broader issue with R3.5.0
original:
I'm pretty new to R, and not savvy with all of it's joys.
I've just had my works computer upgrade (result!) to windows 10 with java version 8.1 64bit; r 3.5.0, and r studio 1.1.447.
My code is no longer loving qdap package. It claims to install but won't library in.
CODE:
`pkg <- c("rJava","rmarkdown", "tidyverse","ggplot2", "knitr", "tm", "RColorBrewer", "wordcloud", "qdapDictionaries","qdapRegex", "qdapTools","qdap")
new.pkg <- pkg[!(pkg %in% installed.packages())]
if (length(new.pkg)) {
install.packages(new.pkg, repos = "http://cran.rstudio.com")
}
library(qdap)`
output:
`Loading required package: qdapTools
Error: package or namespace load failed for ‘qdapTools’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘data.table’
Error: package ‘qdapTools’ could not be loaded`
googling suggested I needed to modify the dependencies part, which threw this one
`install.packages(new.pkg, repos = "http://cran.rstudio.com", dependencies = TRUE)
also installing the dependencies ‘data.table’, ‘koRpus’, ‘lda’, ‘proxy’, ‘SnowballC’
Package which is only available in source form, and may need compilation of C/C++/Fortran:
‘data.table’
These will not be installed`
Any thoughts (and fixes!) much appreciated. sorry for obvs noobie question.
I am by no means an expert here, but found a fix for this exact same problem earlier today!
Download and install the most recent version of RTools from the following link:
https://cran.r-project.org/bin/windows/Rtools/.
After restarting R, run this code:
install.packages("data.table")
When the error message arises, you should see a pop-up asking if you'd like to attempt to install the package from its source. Click 'yes' and it should install correctly!
The GitHub for data.table has directions to a daily-build windows binary of data.table https://github.com/Rdatatable/data.table/wiki/Installation
following the instructions on this and installing from the zip file now works. note that a few days ago it did not. Hopefull "normal" install practices will work soon too.

R tm package will not load to R studio

I have been trying to load the tm text mining package onto R studio for a number of hours now. I have tried everything I have come across online but it doesnt appear to work.
I started with
install.packages('tm', dependencies = TRUE)
and am given the following error
Installing package into ‘D:/Users/byrne/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependencies ‘slam’, ‘Rcampdf’, ‘Rgraphviz’, ‘Rpoppler’, ‘tm.lexicon.GeneralInquirer’ are not available
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/tm_0.6-2.zip'
Content type 'application/zip' length 710948 bytes (694 KB)
downloaded 694 KB
when i then try to load the package using
library(tm)
I get this error
Loading required package: NLP
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘slam’
Error: package or namespace load failed for ‘tm’
I have then loaded NLP and tried to load 'slam'. which it then tells me is not available on R version 3.2.3. I then updated to 3.2.5 and it still gives me the same message. I have changed the CRAN mirror to mutliple different locations and still get the same error.
Any help is greatly appreciated as I'm stumped now.
It is probably that 'slam' can not be installed because of '-lgfortran' package error. You need to apply below;
You need to close all R sessions also R Studio.
Open terminal and type xcode-select --install
Type curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
Type sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
You can install 'slam' now.
Try sudo apt-get install r-cran-slam on your terminal
It should work properly after that.
use command
install.packages("tm", repos="http://R-Forge.R-project.org")
Dependency package ‘slam’ is not available until R version 3.3.1 and you are using version 3.2.X.
Also, keep in mind that some of the dependency packages (like Rgraphviz) are no longer at the CRAN repository, but are at the Bioconductor site as explained in the answer to this question.
whenever it says "there is no package called ---", just install that package, restart your r session and this time it will load fine.

Error: package or namespace load failed for ggplot2 and for data.table

I am not able to open install the ggplot2 and data.table packages.
It gives me the following error (example for ggplot2)
> library(ggplot2)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘ggplot2’
I was able to work fine with these 2 packages before I closed my R session. Now it shows me this error each time I try to run it.
I have also tried to remove and re-install it, but without success.
remove.packages(c("ggplot2", "data.table"))
install.packages('ggplot2', dep = TRUE)
install.packages('data.table', dep = TRUE)
I am not sure what's wrong
This solved the issue:
remove.packages(c("ggplot2", "data.table"))
install.packages('Rcpp', dependencies = TRUE)
install.packages('ggplot2', dependencies = TRUE)
install.packages('data.table', dependencies = TRUE)
After a wild goose chase with tons of Google searches and burteforce attempts, I think I found how to solve this problem.
Steps undertaken to solve the problem:
Uninstall R
Reinstall R
Install ggplot with the dependencies argument to install.packages set to TRUE
install.packages("ggplot2",dependencies = TRUE)
The above step still does NOT include the Rcpp dependency so that has to be manually installed using the following command
install.packages("Rcpp")
However, while the above command successfully downloads Rcpp, for some reason, it fails to explode the ZIP file and install it in my R's library folder citing the following error:
package ‘Rcpp’ successfully unpacked and MD5 sums checked Warning in
install.packages : unable to move temporary installation
‘C:\Root_Prgs\Data_Science_SW\R\R-3.2.3\library\file27b8ef47b6d\Rcpp’
to ‘C:\Root_Prgs\Data_Science_SW\R\R-3.2.3\library\Rcpp’
The downloaded binary packages are in
C:\Users\MY_USER_ID\AppData\Local\Temp\Rtmp25XQ0S\downloaded_packages
Note that the above output says "Warning" but actually, it is an indication of failure to install the Rcpp package successfully within the repository. I then used the Tools-->Install packages--> From ZIP file and pointed to the location of the "downloaded binary packages" in the message above -
C:\Users\MY_USER_ID\AppData\Local\Temp\Rtmp25XQ0S\downloaded_packages\Rcpp_0.12.3.zip
This led to successful installation of Rcpp in my R\R-3.2.3\library folder, thereby ensuring that Rcpp is now available when I attempt to load the library for ggplot2. I could not do this step in the past because my previous installation of R would throw error stating that Rcpp cannot be imported. However, the same command worked after I uninstalled and reinstalled R, which is ODD.
install.packages("C:/Users/MY_USER_ID/AppData/Local/Temp/Rtmp25XQ0S/downloaded_packages/Rcpp_0.12.3.zip", repos = NULL, type = "win.binary")
package ‘Rcpp’ successfully unpacked and MD5 sums checked`
I was finally able to load the ggplot2 library successfully.
library(ggplot2)
Faced same issue and solved by :
remove.packages("ggplot2")
install.packages('ggplot2', dependencies = TRUE)
I also faced the same problem and
remove.packages(c("ggplot2", "data.table"))
install.packages('Rcpp', dependencies = TRUE)
install.packages('ggplot2', dependencies = TRUE)
these commands did not work for me. What I found was that it was showing a warning message that it could not move temporary installation C:\Users\User_name\Documents\R\win-library\3.3\abcd1234\Rcpp to C:\Users\User_name\Documents\R\win-library\3.3\Rcpp.
I downloaded the Rcpp zip file from the link given and unziped it and copied it inside C:\Users\User_name\Documents\R\win-library\3.3 and then
library(Rcpp)
library(ggplot2)
worked. I did not have to uninstall R. Hope this helps.
when you see
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)
answer no
Try this:
install.packages('Rcpp')
install.packages('ggplot2')
install.packages('data.table')
I had the same problem with the package "tidyverse". I solved the problem with
1. uninstalling the package "Rcpp" and "tidyverse"
2. reinstalling "Rcpp" and answering the following questions during the installation process:
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)
with
no
reinstalling "tidyverse".
I tried the steps mentioned in the earlier posts but without any success. However, what worked for me was uninstalling R completely and then deleting the R folder which files in the documents folder, so basically everything do with R except the scripts and work spaces I had saved. I then reinstalled R and ran
remove.packages(c("ggplot2", "data.table"))
install.packages('Rcpp', dependencies = TRUE)
install.packages('ggplot2', dependencies = TRUE)
install.packages('data.table', dependencies = TRUE)
This rather crude method somehow worked for me.
I tried all the listed solutions above but nothing worked.
This is what worked for me.
Look at the complete error message which you get when you use library(ggplot2).
It lists a couple of packages which are missing or have errors.
Uninstall and reinstall them.
ggplot should work now with a warning for version.
These steps work for me:
Download the Rcpp manually from WebSite
(https://cran.r-project.org/web/packages/Rcpp/index.html)
unzip the folder/files to "Rcpp" folder
Locate the "library" folder under R install directory Ex:
C:\R\R-3.3.1\library
Copy the "Rcpp" folder to Library folder.
Good to go!!!
library(Rcpp)
library(ggplot2)
For me, i had to uninstall R from brew brew uninstall --force R and then head over to the R website and download and install it from there.
I had this same problem, but when running in a jupyter R notebook in an Anaconda environment.
The problem presented in such a way that any R notebook opened would instantly die and would not allow cell execution. The error would show up with each failed automated attempt to start the kernel:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
To solve this, I ran as admin/sudo: conda install -c r r-rcpp, restarted the kernel, and everything was back to normal.
Sorry for joining the party late, You can install any package in RStudio by downloading the zip file from the CRAN website and running the below snippet in the console,
install.packages('~/Downloads/Rcpp_1.0.8.tgz', repos = NULL, type = 'source')

R: Problems with unloadNamespace(package) when installing a package

I made an R-package called TRIMmaps and tried to install it with the command
R CMD INSTALL TRIMmaps_v1.12.0
I received the following error message:
Error in unloadNamespace(package) :
namespace ‘Rcpp’ is imported by ‘plyr’ so cannot be unloaded
Error in library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) :
“Rcpp” version 0.11.2 cannot be unloaded.
I do need package plyr, however, because when I remove it I get the message:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘plyr’
I removed both packages plyr and Rcpp and installed them again. My current version of Rcpp now is 0.11.5, but when I try to install the TRIMmaps-package again, I get the same error message as above including the line “Rcpp” version 0.11.2 cannot be unloaded. Although I have removed the older Rcpp-version and replaces it by 0.11.5, here still a problem occurs with 0.11.2.
How do I solve this? Any hint is appreciated.
I get a similar error. Minimal conditions to reproduce it seem to be:
Depend on a package x (in my case reshape)
In your vignette load a packge y (in my case plyr) that also imports or depends on x.
The vignette builds fine if you build it outside of the package building or checking process, but throws the error that you indicate otherwise. The error is also R version and maybe site specific, since it goes away with R 3.2.0 when trying to build the package on a different machine.
The easiest way is to close (R-Studio), or open a new (GUI), and do the job, and you can copy your code and reuse them.
**#This package is not installed ,but use tamp :
install.packages("tamp", dependencies=TRUE)
If you mean TRIM MAP SITE:
https://www2.gov.bc.ca/gov/content/data/geographic-data-services/topographic-data/raster-base-maps
#derderi**
In search box, type command prompt
In the command prompt, change directory to the place that contains the R package.
Build R package using R CMD build pkgName. For example I use R CMD build cum*. A tar.gz
The file is built under the working directory.
There's a PDF Tutorial that goes more in-depth.

Causes of "Error: package '_____' was built before 3.0.0: please re-install it" in R

On one computer running R 2.15.2 I have installed packages from a .zip file (these packages happened to be ggplot2 and data.table, but I don't think the specific package is my issue.) Everything works fine. I took these packages to a computer without an internet connection and installed them. This other computer is running R 3.0.1. The packages seemed to install without a problem (using R's "install package(s) from local zip file" option). When I call the packages with the library(), I get the following error:
Error: package '<insert name of newly installed package here>' was build before 3.0.0: please-re-install it
Can anyone explain potential causes for this error to be thrown? Are there particular directories that the .zip packages must be in for a proper install? If R is installed on a separate partition from where the .zip packages were loaded, could this cause the error?
I'm at a loss, any pointers are greatly appreciated. This is a difficult one to reproduce; if you need any other version/system parameters to understand the problem, please don't hesitate to ask.
I found this solution while look at GitHub ggplot2 issue #796
update.packages(checkBuilt = TRUE, ask = FALSE)
It will update all the packages that need to be reinstalled.
Running install.packages("codetools") can fix this issue for R 3.0.2, if you have the same problem like me:
installing to /home/user/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/libs
** R
** inst
** preparing package for lazy loading
Error : package ‘**codetools**’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘Rcpp’
ERROR: lazy loading failed for package ‘Rcpp’
I installed shiny according https://github.com/rstudio/shiny-server/wiki/Ubuntu-step-by-step-install-instructions
and got the same error at the step
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
Warning messages:
1: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘Rcpp’ had non-zero exit status
2: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘httpuv’ had non-zero exit status
3: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘shiny’ had non-zero exit status
I tried the answer by Richard Lee by starting R
R
and got the error
Warning in install.packages("shiny") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (y/n) n
Error in install.packages("shiny") : unable to install packages
obviously no write permission, so
sudo R
Now I tried again
install.packages("shiny")
and got a number of errors
Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : package ‘RJSONIO’ was built before R 3.0.0: please re-install it
Error : package ‘caTools’ was built before R 3.0.0: please re-install it
Error : package ‘bitops’ was built before R 3.0.0: please re-install it
Error : package ‘digest’ was built before R 3.0.0: please re-install it
Error : package ‘xtable’ was built before R 3.0.0: please re-install it
Each time I got an error, I re-installed the requested package
install.packages("codetools")
install.packages("RJSONIO")
etc.
and eventually, I was able to install Rccp, httpuv, and even shiny.
Now it works!!
Also see
Shiny package installation on R version 3.0.2 "Frisbee Sailing"
I am using rkward on precise
I had a similar error using rkward. Specifically this one:
'lib = "/usr/local/lib/R/site-library"' is not writable
I temporarily changed the permissions for this directory so that rkward could run this from its console:
update.packages(checkBuilt = TRUE, ask = FALSE)
all to fix this:
Error: package '' was build before 3.0.0: please-re-install it
so that (sigh...) I could fix 'default' configuration for audio on precise. I couldn't use play() etc. in rkward.
That just needed phonon-backend-gtstreamer
I tried to install swirl on R(v3.1.0) on ubuntu 12.04LTS:
sudo R
install.packages("swirl")
But faced a similar error:
Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘httr’
ERROR: lazy loading failed for package ‘httr’
* removing ‘/usr/local/lib/R/site-library/httr’
ERROR: dependencies ‘testthat’, ‘httr’ are not available for package ‘swirl’
* removing ‘/usr/local/lib/R/site-library/swirl’
Doing following helped me:
install.packages('codetools')
install.packages("swirl")
library("swirl")
swirl()
| Welcome to swirl! Please sign in. If you've been here before, use the same
| name as you did then. If you are new, call yourself something unique.
What shall I call you?
I hope the same may help fix your installation issue.
Here is the work-around that I used:
I installed the latest version of R on an internet-capable computer. I then loaded the my required packages (Packages->install packages->select mirror->select package...
After R is finished installing, it displays a message of where the temporary .zip package is located. I navigated to this location, grabbed the temp package, and burnt it to a cd.
In this way, I could get the newer package build onto a computer without internet access. I would still be interested to know if there is an easy way to rebuild a package downloaded on an early R version to make it compatible with the latest version (without needed an internet connection).
Thanks for pointing me in the right direction #JoshuaUlrich

Resources