Emily Kothe
Emily Kothe

Reputation: 872

Error: package or namespace load failed, object ... not found

I am running a new install of R (3.5.0) and RStudio (1.1.414). [Note I have now updated to 3.5.1 and 1.1.453 and am still experiencing the issues below with the exception of the "built under R version 3.5.1" warning messages]

I have installed the rlang package using install.packages("rlang") without encountering any issues but when I attempt to load the package I get the following error

Error: package or namespace load failed for ‘rlang’: .onLoad failed in loadNamespace() for 'rlang', details: call: dots_list(...) error: object 'rlang_dots_list' not found In addition: Warning message: package ‘rlang’ was built under R version 3.5.1

I've uninstalled and reinstalled rlang (closing restarting RStudio in between each command) and am still encountering this error.

I am also encountering a set of similar (although possible totally unrelated) issue with other packages

  1. RStudio provides the following warning every startup

    [Workspace loaded from ~/.RData]
    
    Error in yaml.load(readLines(con), error.label = error.label, ...) : 
       object 'C_unserialize_from_yaml' not found
    Error in yaml.load(readLines(con), error.label = error.label, ...) : 
      object 'C_unserialize_from_yaml' not found
    
  2. library(devtools) gives the following errors

    Error: package or namespace load failed for ‘devtools’ in FUN(X[[i]], ...):
     no such symbol digest in package //[redacted]/My 
    Documents/R/win-library/3.5/digest/libs/x64/digest.dll
    In addition: Warning message:
    package ‘devtools’ was built under R version 3.5.1 
    

Someone on twitter asked for the results of packageDescription("rlang")

I've copied the output below in case it helps with troubleshooting.

Package: rlang
Version: 0.2.1
Title: Functions for Base Types and Core R and 'Tidyverse' Features
Description: A toolbox for working with base types, core R features like the condition system, and core
        'Tidyverse' features like tidy evaluation.
Authors@R: c( person("Lionel", "Henry", ,"[email protected]", c("aut", "cre")), person("Hadley", "Wickham",
        ,"[email protected]", "aut"), person("RStudio", role = "cph") )
License: GPL-3
LazyData: true
ByteCompile: true
Depends: R (>= 3.1.0)
Suggests: crayon, knitr, methods, pillar, rmarkdown (>= 0.2.65), testthat, covr
RoxygenNote: 6.0.1
URL: http://rlang.tidyverse.org, https://github.com/r-lib/rlang
BugReports: https://github.com/r-lib/rlang/issues
NeedsCompilation: yes
Packaged: 2018-05-30 13:14:55 UTC; lionel
Author: Lionel Henry [aut, cre], Hadley Wickham [aut], RStudio [cph]
Maintainer: Lionel Henry <[email protected]>
Repository: CRAN
Date/Publication: 2018-05-30 14:23:07 UTC
Built: R 3.5.1; x86_64-w64-mingw32; 2018-07-02 15:08:55 UTC; windows

-- File: [redacted]/My Documents/R/win-library/3.5/rlang/Meta/package.rds 

Upvotes: 5

Views: 35172

Answers (3)

Emily Kothe
Emily Kothe

Reputation: 872

Answering my own question in case anyone else encounters a similar issue in the future...

Working with my work IT department we have now tied this to custom permissions on my workstation that mean that R packages can only be run to pre-specified libraries (in my case "C:\R\R-3.4.3\library").

Installing packages directly into that location fixes the issue but is not desirable for all the reasons that people might want to use custom locations (e.g. running multiple versions of the same package, keeping separate libraries for some projects).

As such there are two solutions that may be more or less attainable given your own IT system.

  1. Convince your IT department to relax the permissions for R packages to allow custom library locations.
  2. Give up and run everything from the "permitted" library location (e.g. C:\R\R-3.4.3\library)
  3. Raise a support ticket every time you need to install a package into a custom location and hope that IT eventually gives in.

Upvotes: 3

Jeroen Ooms
Jeroen Ooms

Reputation: 32978

You have 3 different warnings (digest, yaml, and rlang) that each indicate that a package DLL file is corrupted. You are doing something very wrong when installing your packages.

The most common cause of this problem is trying to update a package while it is loaded in R (possibly in another process!). It could also be caused by a bad antivirus program that locks the dll which prevents it from being updated. Please try the following steps:

  1. Quit all R/Rstudio sessions. Check in taskmgr that no Rterm or Rgui process is running.
  2. Delete the folders yaml, rlang and digest inside Documents\R\win-library\3.5\ and also inside C:\Program Files\R\R-3.5.x\library\ if they exists there as well.
  3. Start R to confirm they are gone. Running library(yaml) or library(rlang) should give an error e.g: there is no package called ‘yaml’. Quit R.
  4. Start a new R and run: install.packages(c("yaml", "rlang", "digest"))
  5. Pay close attention to the output, especially the final lines. If you see a warning like below the installation got corrupted and you should remove the package!

enter image description here

Upvotes: 5

Lionel Henry
Lionel Henry

Reputation: 6803

This sort of problems almost always comes from a bug in R on Windows: If you reinstall a package that includes compiled code, and if that package is already loaded in R, the DLL will not get updated.

Please try reinstalling rlang on a fresh session. Sometimes packages get loaded automatically at startup from .RProfile and you can check this by calling sessionInfo() after starting up.

Upvotes: 0

Related Questions