How to do i resolve the following code error?
library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’:
.onLoad failed in loadNamespace() for 'tidyselect', details:
call: is_string(x)
error: object 'rlang_is_string' not found
In addition: Warning message:
package ‘tidyverse’ was built under R version 3.5.3
For persistent errors of type, first, ensure you are working with the latest version of R. The installr package is a very convenient way to do this.
Then, start new R session (ideally, not in RStudio).
Uninstall tidyverse, tidyselect, and rlang
# if you are using multiple libraries, you may need to specify libpath,
# using the following: lib="~/R/win-library/3.6"
# you can check using the .libPaths() command
remove.packages("rlang")
remove.packages("tidyselect")
remove.packages("tidyverse")
and, reinstall them one by one with dependencies = TRUE
install.packages("rlang", dependencies = TRUE)
install.packages("tidyselect", dependencies = TRUE)
install.packages("tidyverse", dependencies = TRUE)
That should do it.
I also encounter a similar problem like you, which I'm unable to load the tidyverse too.
Hope this discuss from the tidyverse github issues maybe relevant to you.
https://github.com/tidyverse/googledrive/issues/275
Here's one of our typical explanations of this. Note that this is not specific to googledrive or rlang. It's an R + Windows gotcha. I suspect for you is rlang (at least).
Please note that on Windows, it is very important to quit or restart
all R processes before upgrading , because if any R process has
loaded, it will keep the .dll file open and the installer will not be
able to overwrite .dll. The error message when this happens is very
easy to overlook, and the new version will be partially installed: the
package description and R code will be updated but the compiled code
(in .dll) will not.
Related
I am new to R. I am using version 4.0.2 (windows) and it was working well until I tried to use "dplyr" and "tidyverse" packages. I am able to download both packages but when I try to load them I get the error below. I have tried reinstalling R and Rstudio, I have tried update.packages() and then restarted Rstudio but still I get this error. If I try require(dplyr), then I still this error.
Can anyone please help me?
> library(dplyr) Error: package or namespace load failed for ‘dplyr’ in namespaceExport(ns, exports): undefined exports: as_glue, backtick, double_quote, glue, glue_col, glue_collapse, glue_data, glue_data_col, glue_data_safe, glue_data_sql, glue_safe, glue_sql, identity_transformer, single_quote, trim In addition: Warning message: S3 methods ‘+.glue’, ‘[.glue’, ‘[[.glue’, ‘as.character.glue’, ‘as_glue.character’, ‘as_glue.default’, ‘as_glue.glue’, ‘print.glue’ were declared in NAMESPACE but not found
This became too long for a comment, but it might be because the library dplyr is part of the tidyverse library. tidyverse is much bigger, and includes a bunch of different libraries/packages https://www.tidyverse.org/packages/
Do you still get the error if you load dplyr without tidyverse? In other words does the error only come when you load the second package, regardless of which is the second? It might be telling you that it can't load the package twice, but I am not sure, I haven't seen this specific error message.
I just wanted to share that I managed to fix this problem. I realised that the folder where the packages were being stored was being backed up in OneDrive, ie. OneDrive was in the file pathway. So I unlinked my OneDrive, re-installed R, Rtools & Rstudio and then both dplyer and tidyverse started working for me. I don't know why I didn't have that error with other packages but this seems to have fixed it...
I had the same problem and the issue was, specifically, that the 'digest' package was stored into my OneDrive. The issue was solved (after three days of struggle) when I created a local library (~/local-lib) for the package that required ggplot2 (called, "factoextra").
install.packages("ggplot2", lib = "C:/Users/MY_USER_NAME/R/local-lib")
library("ggplot2",lib = "C:/Users/MY_USER_NAME/R/local-lib")
install.packages("digest", lib = "C:/Users/MY_USER_NAME/R/local-lib")
library("digest",lib = "C:/Users/MY_USER_NAME/R/local-lib")
install.packages("factoextra", lib = "C:/Users/MY_USER_NAME/R/local-lib")
library("factoextra",lib = "C:/Users/MY_USER_NAME/R/local-lib")
Another more permanent solution is published here, but I only have limited administrative rights to my computer, so I couldn't pull this one off. If you are hampered by admin rights, you can potentially run your R environment in Anaconda, which also isn't a perfect solution, but for those of us in universities with stringent IT departments, that seems to work alright.
I had a similar problem with the civis package and determined that installing the roxygen2 package first would allow the civis installation to complete. It still gave a bunch of namespace warnings, and I'm having to call civis functions using the civis:: prefix, but other than that it seems to work.
I doubt this is the only cause of this kind of error, but if you're having problems it might be worth a try!
A similar question was asked here, but I tried the code Tiago Lubiana posts there, to no avail.
I haven't been able to install rstanarm after several attempts. R keeps crashing during the installation.
I did install rstan by running
install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)
When I want to install rstanarm, nothing seems to work, though. I've tried the following:
1) install.packages("rstanarm"): R crashes and installs a folder called 00LOCK-rstanarm, plus the corresponding rstanarm folder. When I open R, rstanarm is there, but after running library(rstanarm), I get
Error: package or namespace load failed for ‘rstanarm’ in library.dynam(lib, package, package.lib):
shared object ‘rstanarm.so’ not found
By running install.packages("rstanarm") again, I get:
ERROR: failed to lock directory ‘/home/nalerive/R/x86_64-pc-linux-gnu-library/3.5’ for modifying
Try removing ‘/home/nalerive/R/x86_64-pc-linux-gnu-library/3.5/00LOCK-rstanarm’
Warning in install.packages :
installation of package ‘rstanarm’ had non-zero exit status
Deleting that folder has not solved the problem (but see here for a similar error with another package).
2) From here, running
if (!require(devtools)) { install.packages("devtools")
library(devtools) }
install_github("stan-dev/rstanarm", build_vignettes = FALSE)
leads to R crashing again, and the same folders as in 1) are installed. I also get the same error by running library("rstanarm"), namely:
Error: package or namespace load failed for ‘rstanarm’ in library.dynam(lib, package, package.lib):
shared object ‘rstanarm.so’ not found
3) Following this post I tried
install.packages("rstanarm", dependencies = TRUE, repos="http://cran.rstudio.com/", INSTALL_opts = c('--no-lock'))
and R keeps crashing.
I've tried more things, like removing the 00LOCK-rstanarm folder by means of unlink("/home/nalerive/R/x86_64-pc-linux-gnu-library/3.5/00LOCK-rstanarm/", recursive = TRUE); restarting R when indicated; checking my C++ toolchain (as suggested here), etc... but nothing has worked. I really feel hopeless at this point.
I have R version 3.5.2, rstan version 2.19.2, and Linux 4.15.0-1-amd64 #1 SMP Debian 4.15.4-1~mx17+1 (2018-02-23)
Any help will be highly appreciated. Thanks in advance!
I have been experiencing the problem of not being able to load package libraries in R. The packages install fine via instal.packages(), but I get the error
Error: package or namespace load failed for ‘adegenet’ in library.dynam(lib, package, package.lib):
shared object ‘httpuv.so’ not found
Error: package ‘adegenet’ could not be loaded
When I attempt to load the package 'adegenet' (and any other packages).
I recall this behaviour started to occur when I used remove.packages() to remove shiny in order to install the development version on GitHub (shiny-Incubator).
I am unsure as to what is going on. Any ideas on how to restore everything? I updated to the most recent R version, but this did not fix things.
It seems that during your uninstallation procedure you managed to remove a component of httpuv and/or Rcpp. This should get things working again:
install.packages(c("Rcpp", "httpuv"))
The R studio I have in my university computer gives me an error when I try to download different packages, whereas when I'm with my laptop in the university server, I don't get this error. Because of this, I don't think that there is some kind of a proxy/server problem.
library(readr)
Error in library(readr) : there is no package called 'readr'
I also tried to download the package using R.exe program or download other packages and it gave me the same error.
After looking for a solution in the internet, I found this script:
install.packages('readr', dependencies = TRUE, repos='http://cran.rstudio.com/')
But it downloaded many different packages:
I would like to know the reason why RStudio gives me this error and what happened when I tried to download readr package using install.packages?
Error in library(readr) : there is no package called 'readr'
This means that you don't have the package readr installed on your computer.
You then installed it with
install.packages('readr', dependencies = TRUE, repos='http://cran.rstudio.com/')
which is good. Most packages are not "stand-alone", they use other packages too, called dependencies. Because you used the default dependencies = TRUE, all the dependencies (and their dependencies) were also installed.
You can look at the CRAN page for readr: https://CRAN.R-project.org/package=readr to see its dependencies (anything in the "Depends" or "Imports" fields is required). And of course you need the dependencies of those dependencies, etc. Now that readr is installed along with its dependencies, you can run library(readr) to load it.
Because you set dependencies = TRUE it installed all the dependencies for the package readr
Those several packages you listed are considered dependencies for readr.
You get that initial error when a package has yet to be downloaded.
I'm working with R, I have installed the library 'rms' but I have the follow error:
> library(rms)
Error in library.dynam(lib, package, package.lib) :
DLL ‘colorspace’ not found: maybe not installed for this architecture?
Errore: package ‘ggplot2’ could not be loaded
What can I do?
If you install from base R and wish to install a package and all its dependencies, you need to use the argument dependencies = TRUE. From ?install.packages:
"dependencies = TRUE ... this installs all the packages needed to run pkgs, their examples, tests and vignettes (if the package author specified them correctly).
Hence,
install.packages("rms",dependencies = TRUE)
should do the trick.
The answer offered so far (without any upvotes so far) is useful, but incomplete. It is sometimes sufficient to execute install.packages() with dependencies = TRUE, but if the missing package is a dependency of a dependency, then install.package is not "smart" enough to recognize that fact. The ggplot2 package is in the "Depends:" line of the rms package DESCRIPTION file, but colorspace is not. Sometimes the end-user simply needs to read the error message and install the missing dependencies.
In this case, however, it appears that there may have been a version mismatch of packages and R.