Reputation: 2199
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
Upvotes: 86
Views: 326128
Reputation: 31
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')
Upvotes: 0
Reputation: 101
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
Upvotes: 2
Reputation: 2886
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.
Upvotes: 0
Reputation: 402
when you see
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)
answer no
Upvotes: 6
Reputation: 10395
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.
Upvotes: 0
Reputation: 11
I tried all the listed solutions above but nothing worked. This is what worked for me.
Upvotes: 1
Reputation: 853
Faced same issue and solved by :
remove.packages("ggplot2")
install.packages('ggplot2', dependencies = TRUE)
Upvotes: 9
Reputation: 135
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:
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
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)
Upvotes: 11
Reputation: 2199
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)
Upvotes: 115
Reputation: 35
These steps work for me:
Good to go!!!
library(Rcpp)
library(ggplot2)
Upvotes: 0
Reputation: 71
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.
Upvotes: 7
Reputation: 21
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.
Upvotes: 1
Reputation: 3376
Try this:
install.packages('Rcpp')
install.packages('ggplot2')
install.packages('data.table')
Upvotes: 3