Package or namespace load failed for 'tcltk' - azure-machine-learning-studio

I am trying to include the "tcltk" library under a R script in Azure Machine Learning Studio (R version 3.1.0). But I am always getting this error:
package or namespace load failed for 'tcltk'
Any ideas please.
Thanks in advance.
Error message:
Error 0063: The following error occurred during evaluation of R script:
---------- Start of error message from R ----------
package or namespace load failed for 'tcltk'
package or namespace load failed for 'tcltk'
----------- End of error message from R -----------
Start time: UTC 06/24/2019 11:27:02
End time: UTC 06/24/2019 11:27:08

Package ‘tcltk’ was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Changing the R version to Microsoft R Open 3.4.4 solved the issue.
library(tcltk)
Microsoft R Open is the enhanced distribution of R from Microsoft
Corporation. It is a complete open source platform for statistical
analysis and data science.
However, if it is crucial for you to use CRAN 3.1.0 let me know, I will try to install the package manually and publish it to the Azure ML Gallery

Related

I can't install the zenplots package in R?

I am having difficulty installing the zenplots package in R. For some odd reason when I use install.packages('zenplots') on my machine (Mac OS Catalina V-10.15.7) it installs fine... but when I try and install it on my second machine (also Mac OS Catalina V-10.15.7) and if I try and install it on my institutes server I get the following error:
Warning in fun(libname, pkgname) : couldn't connect to display ":0"
Error : package or namespace load failed for ‘loon’: .onLoad failed
in loadNamespace() for 'loon', details: call:
structure(.External(.C_dotTcl, ...), class = "tclObj") error: [tcl]
couldn't connect to display ":0".
Error: unable to load R code in package ‘zenplots’ Execution halted
I have also tried to install directly from GitHub using remotes::install_github('great-northern-diver/zenplots', force = T) but I get the same error as above.
I have even tried using install.packages("zenplots", repos="http://R-Forge.R-project.org") which works but unfortunatley this version doesn't contain all the functions found in zenplots.
My R version is above version 3.4.0, which is required for zenplots and as per the documentation I have already installed the graph package from BioConductor.
Any suggestions as to what might be the issue here?
I would guess that the R on your server was compiled without some feature required by the library. My guess: it is missing either tcltk or X11 support. To check do the following:
capabilities()
And see which features return FALSE, meaning they are not enabled.

Error: package ‘StanHeaders’ 2.18.1 was found, but > 2.18.1 is required by ‘rstan’

I am writing an R package that depends on Stan and Rstan. I run the installation on an Azure machine Standard_D64_v3 and install r-base and r-cran-stan with sudo apt-get and rstan and Rcpp with R's install.packages()(among others, see shell setup script and R setup script).
This process worked OK last month. Today I was able to install the package (as evidenced by the welcome message) and then have a runtime error from incompatible versions.
...
* DONE (PosteriorBootstrap)
Reloading attached PosteriorBootstrap
Welcome to PosteriorBootstrap, a parallel approach for adaptive non-parametric learning
Error: package ‘StanHeaders’ 2.18.1 was found, but > 2.18.1 is required by ‘rstan’
In addition: Warning message:
version 2.18.1.10 of ‘StanHeaders’ masked by 2.18.1 in /usr/lib/R/site-library
Execution halted
I do not have StanHeaders anywhere in my code so I suspect the problem is between different packages. How can I solve this problem with versions?
As #nicola wrote in the comments, the fix is to reinstall StanHeaders with:
install.packages("StanHeaders")
The previous code may have stopped working because of a new version of R, but I could not determine the cause.

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
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
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", ,"lionel#rstudio.com", c("aut", "cre")), person("Hadley", "Wickham",
,"hadley#rstudio.com", "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 <lionel#rstudio.com>
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
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:
Quit all R/Rstudio sessions. Check in taskmgr that no Rterm or Rgui process is running.
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.
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.
Start a new R and run: install.packages(c("yaml", "rlang", "digest"))
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!
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.
Convince your IT department to relax the permissions for R packages
to allow custom library locations.
Give up and run everything from the "permitted" library location (e.g. C:\R\R-3.4.3\library)
Raise a support ticket every time you need to install a package into a custom location and hope that IT eventually gives in.
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.

R programming package quantstrat/ FinancialInstrument/ importDefaults loading error

I'm trying to install the package quantstrat, however I always get following errors trying this:
--Error : object ‘importDefaults’ is not exported by 'namespace:quantmod'
Failed with error: ‘package ‘FinancialInstrument’ could not be loaded’
Now, when I tried to load the package FinancialInstrument, R throws the following error:
--Error : object ‘importDefaults’ is not exported by 'namespace:quantmod'
I am not sure what to do to get the package quantstrat loaded. I am using the R version 3.0.0 on windows 64 bit system. Any help would be very much appreciated.

Installing rjags in R on OSX Mavericks

I am trying to install the package "rjags" in R but am running into the following error:
Loading required package: rjags
Error : .onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so, 10): Symbol not found: __ZN5RangeC1ERKSt6vectorIiSaIiEES4_
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so
Expected in: /usr/local/lib/libjags.3.dylib
in /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so
Error: package ‘rjags’ could not be loaded
I've installed JAGS on my Mac (running Mavericks), and I am running R-3.1.2. I've tried installing from the url using the devtools package, as recommended by this site:
install_url("http://sourceforge.net/projects/mcmc-jags/files/rjags/3/rjags_3-2.tar.gz",
args="--configure-args='--with-jags-include=/Users/casallas/homebrew/opt/jags/include/JAGS
--with-jags-lib=/Users/casallas/homebrew/opt/jags/lib'
"
)
I've also gone through the instructions on this other site , trying the different versions of JAGS and receive the same error. I'm at a loss for what to try next and am sure the solution is simple. Does anyone have any insights? Thanks so much!
I found that while I was unable to install rjags from the url, if I installed the package from source on my computer I was successful. I did this by downloading the appropriate package from here (which for me was rjags_3-14.tgz) and ran the following command:
install.packages(path_to_file, repos = NULL, type="source")
The error:
Symbol not found: __ZN5RangeC1ERKSt6vectorIiSaIiEES4_
Is (nearly) always caused by a mismatch between standard libraries between the Mavericks build of R (actually rjags) and Snow Leopard build of JAGS (or vice versa). For more info see the instructions at https://sourceforge.net/projects/mcmc-jags/files/JAGS/3.x/Mac%20OS%20X/
I'm guessing that compiling the package yourself from source worked because it matched the version of the standard library that JAGS is using, but this will no longer match the version that R is using (although I'm not sure if this is a major problem, it is not recommended). You would be better to match the builds of R and JAGS and use the pre-built rjags library from CRAN.
It is interesting that you say you have tried both builds of JAGS but I suggest trying again along these lines:
1) Use .Platform$pkgType in R to confirm if it you are using mac.binary (SL) or mac.binary.mavericks (Mavericks) - or failing that re-install the Mavericks binary of R from CRAN
2) Exit R
3) Re-install the appropriate version of JAGS
4) Re-open R and re-install the rjags library from CRAN
5) Try library(rjags)
If this doesn't work can you provide more information so I can try and track down a possible problem with the JAGS builds?
Thanks,
Matt

Resources