enableJIT in Rprofile leads to 'not a proper evaluation environment' on startup - r

I have had
library(compiler)
compiler::enableJIT(3)
in ~/.Rprofile for years; now that I upgraded to 3.2.1 I get this on startup:
Error in frameTypes(env) : not a proper evaluation environment
Calls: <Anonymous> -> <Anonymous> -> makeCenv -> structure -> frameTypes
> q()
Warning message:
restarting interrupted promise evaluation
I don't see anything relevant in NEWS.
Replacing 3 with 2 in compiler::enableJIT(3) removes the error.
However, I would prefer my loops to be compiled too.
Suggestions?
PS. I observe the same behavior on MacOSX 10.10.4 (R downloaded from cran) and CentOS 6.6 (R installed using yum).

It's a subtle "thinko" (confusing the base namespace environment with the base environment) in the new fast topenv() function which made it into the source code of R in January ... it would really have been great if you had upgraded sooner..... or even tried "R-devel" so this buglet would never have seen the light of day in a released version of R.
Please, please, all ye readers : Do help open source projects such as R by at least using the very latest released versions, .. even better, do occasionally run everyting with "R-devel" --- the development version of R, available via svn, git and most conveniently for installation from the daily snapshot tarballs at http://stat.ethz.ch/R/daily/

Related

What to do when a dependency chain ends? (R install via conda)

I am pretty dang stumped on this one. I am attempting to install the R package diceR (https://github.com/AlineTalhouk/diceR) on an HPC system where software must be compiled locally. The way things were setup -- before I came in -- was to try using conda for everything we could. So we have system install of conda, with user environments saved locally (I've heard this is poopoo'd - but hey... I'm just working with what I was given).
In comes diceR. Most R installs are easy easy, create a new R-environment, go into R and do a package.install("package"). I have had the strangest time with this package - circular or dead end dependencies that I can't explain.
I was hoping someone might have experience with something similar and have ideas on next steps. I know this is a niche package, and I'm not necessarily asking to get help on this exact problem - more along the lines of what to do when something like this happens. Below is the "dependency" chain issue I've been having (from CRAN Depends: R ≥ 3.5)
$ conda activate r-env
$ R --version
R version 4.1.1 (2021-08-10) -- "Kick Things"...
$ R
>install.packages("diceR")
lots of compilation happens, but enevitabley fails...
ERROR: dependency ‘NMF’ is not available for package ‘diceR’
removing ‘/projects/gehi0941/software/anaconda/envs/R_diceR/lib/R/library/diceR’
So I try installing NMF...
ERROR: dependency ‘Biobase’ is not available for package ‘NMF’
removing ‘/projects/gehi0941/software/anaconda/envs/R_diceR/lib/R/library/NMF’
Then Biobase...
Warning message:
package ‘Biobase’ is not available for this version of R
Then I'm done, I've followed this chain all the way down, right? Talking language/manager agnostic now: what do folks to at this step?

Unable to load Rcpp package

Due to my company's firewall I am manually installing packages from local. No errors when building the package from terminal, but I get an error when I load the package using library function
unable to load shared object 'C:/Program Files/R/R-3.6.1/library/Rcpp/libs/x64/Rcpp.dll':
LoadLibrary failure: The specified procedure could not be found.
And it also throws a prompt
Any help is appreciated thanks!
Tried:
Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object
https://github.com/r-lib/rlang/issues/306
None of the above seemed to work
I had this issue. I was using R 4.0.0 in RStudio (1.2.5042). I had been using R just fine all morning and continually had this issue all afternoon. I restarted my computer, updated my packages, and confirmed everything worked well on another computer. Finally I updated to R 4.0.2 and my issue resolved.
My binary package was correctly pathed to 4.0/Rcpp. I still don't know what caused the issue, but since this seemed to fix it hope it will for any future folk with this issue!
There has been a significant change in the build tools used for binary R packages on Windows:
Starting with R 4.0.0 (released April 2020), R for Windows uses a brand new toolchain bundle called rtools40.
https://cran.r-project.org/bin/windows/Rtools/
This means one has to be extra careful to get the correct file when downloading binary packages from CRAN, since packages for build with incompatible build tools will not work. At the time of writing this means:
Use the ones for r-oldrel for R 3.6
Use the ones for r-release for R 4.0
When this question was asked, R 4.0 was still r-devel.
You do not have to think about this things when using the build in install.packages() instead of manually downloading files from CRAN.

Using R package RJulia

I would like to install the R Package JuliaCall, to use Julia from R. I have installed Julia via snap and installed the JuliaCall R package form the Cran.
I received the following error when trying to use the setup function of JuliaCall.
library(JuliaCall)
julia <- julia_setup()
Julia version 1.0.4 at location /snap/julia/13/bin will be used.
Error in dyn.load(.julia$dll_file) :
unable to load shared object '/snap/julia/13/bin/../lib/libjulia.so.1':
/snap/julia/13/bin/../lib/libjulia.so.1: wrong ELF class: ELFCLASS32
Show Traceback
Rerun with Debug
Error in juliacall_initialize(.julia$dll_file) :
/snap/julia/13/bin/../lib/libjulia.so.1 - /snap/julia/13/bin/../lib/libjulia.so.1: wrong ELF class: ELFCLASS32
Julia is installed:
XRJulia::findJulia()
[1] "/snap/bin/julia"
I have tried some suggestions found in
https://github.com/Non-Contradiction/JuliaCall/issues/72
and even report my problems, but I'm not sure if this is an issue to open on Github or a problem with my installation.
The same error occurs
My system specifications are:
Ubuntu 18.04,
Rstudio 1.1.456,
R 3.5.1,
Julia installed via snap
Thanks for any help you could provide
Actually, the developer of JuliaCall answered my question.
I have installed Julia using snap without noticing that a 32bits version was used. Installing Julia from the .tar.gz archive and choosing the correct 64 bits version solve this problem.
Many Thanks to #Non-Contradiction.

Package unavailable in package build after R update using packrat

I recently updated to R 3.1.3 and I am building a package using RStudio and packrat. I am trying to re-build my package using RStudio's in built "Build and Reload" tool, but it won't work. I keep receiving the following error:
Updating standaRd documentation
Loading standaRd
Error in (function (dep_name, dep_ver = NA, dep_compare = NA) :
Dependency package ggplot2 not available.
Calls: suppressPackageStartupMessages ... <Anonymous> -> load_all -> load_depends -> mapply -> <Anonymous>
Execution halted
Exited with status 1.
The thing is, I have ggplot2 installed in all places including my local libraries and my packrat libraries for this project for both R 3.1.2 and R 3.1.3. I have tried loading them in to no avail.
Also, using devtools::build() and devtools::document() both work, so I am assuming that this is an RStudio issue?
I am using RStudio Version 0.99.235. I also cannot see any of my documentation for my package and it doesn't appear to be in my packrat library.
I have since uninstalled R 3.1.3 and reverted back to R 3.1.2 and I am still getting the same issue.
These are my dependencies:
Depends:
R (>= 3.1.2),
ggplot2 (>= 1.0.0),
grid
packrat doesn't seem to be great at handling this, and I always fail to find the documentation I'm looking for. I managed to get it to install packages for the new version, but I don't know exactly which steps were crucial and in which order.
packrat.lock contained a reference to the old RVersion. This can be updated by hand, but packrat::snapshot() also did it for me. I tried packrat::restore() after this and didn't see a new directory for the R version in PROJECT/packrat/lib/ARCH/. I tried restarting and reloading RStudio, the project and packrat a few times and eventually got it to install packages in there. One more project reload and the packages could be seen.
I think there is a "blessed" command sequence for this and it was easier for me in the past.
It may worth to use the renv package instead of packrat.
From https://rstudio.github.io/renv/articles/renv.html
The goal is for renv to be a robust, stable replacement for the
Packrat package, with fewer surprises and better default behaviors.

R 3.0.1 package build warning

I'm building R packages in R 3.0.1 on a Windows machine, using Rtools30 and the 'Build' tools associated with RStudio, which I assume is tied in with devtools (which is up-to-date). My typical process to build a package is:
Load All
Reoxygenize
Build & Reload
Check
Build Source Package
If everything goes without errors or warnings, I then:
install.packages("foo.tar.gz", repos=NULL, type="source")
Since upgrading to R 3.0.1, I now get this warning:
Warning in install.packages :
foo.tar.gz is not available (for R version 3.0.1)
I also tried before installing, and it did not get rid of the warning:
options(install.packages.check.source = FALSE)
Also, I notice this warning when I open the devtools library:
WARNING: Rtools 3.0 found on the path at c:/Rtools is not compatible with R 3.0.1.
Which is weird, Rtools 3.0 is suppose to be good from R >2.15.1 to R 3.0.x
Any ideas what is going on?
This is RStudio specific, as they wrap and/or changed a lot of functions from the utils for better integration. The problem lies with a call to getDependencies() to check for dependencies. But that function will also check whether the original package exists on CRAN and throws the given warning when it doesn't. A package you just built on your own computer is obviously not on CRAN, hence the warning.
In the source of the native install.packages(), getDependencies() isn't called in case you build from source or install from a different repository respectively. RStudio on the other hand calls getDependencies() before it passes everything on to the native install.packages() function.
This has to my knowledge no further effects, apart from confusing people. I didn't find a way to conveniently get rid of this in RStudio, as suppressWarnings() doesn't work in this context due to the complex way RStudio deals with this.
In a basic R console, you shouldn't have any problem.
So for the time being, I'd just ignore this and hope the RStudio team finds time to take care of this minor glitch.

Resources