Hello everyone,
It is well-known that "properly" installing data.table
on Mac is challenging. If one simply runs install.packages("data.table")
, they will get the following message upon loading the library:
data.table 1.14.2 using 1 threads (see ?getDTthreads). Latest news: r-datatable.com
**********
This installation of data.table has not detected OpenMP support. It should still work but in single-threaded mode.
This is a Mac. Please read https://mac.r-project.org/openmp/. Please engage with Apple and ask them for support. Check r-datatable.com for updates, and our Mac instructions here: https://github.com/Rdatatable/data.table/wiki/Installation. After several years of many reports of installation problems on Mac, it's time to gingerly point out that there have been no similar problems on Windows or Linux.
**********
Luckily, the developers of the data.table provide instructions on how to solve this issue. Having installed the GNU Fortran complier from CRAN and following other steps in the instruction, I can get the proper installation in RStudio, when I work outside a project and do not use renv
. I would like to get it working in a project that uses renv
. The actual installation step in R looks like this:
remove.packages("data.table")
install.packages("data.table", type = "source",
repos = "https://Rdatatable.gitlab.io/data.table")
When I load the package using library(data.table)
(outside any project in RStudio), I get the following message
data.table 1.14.3 IN DEVELOPMENT built 2021-12-21 03:03:48 UTC; root using 4 threads (see ?getDTthreads). Latest news: r-datatable.com
Now, I switch to one of my existing R Projects that have renv
going on. I attempt to install data.tables using the same approach:
remove.packages("data.table")
renv::purge("data.table") # remove data.table from cache, to prevent re-installing from the 'bad' installations
install.packages("data.table", type = "source",
repos = "https://Rdatatable.gitlab.io/data.table")
For some reason, the installation is
- Very quick
- Uses
'https://cran.rstudio.com/bin/macosx/contrib/4.1/data.table_1.14.2.tgz'
instead of the repo provided - installs a different version
- Most importantly, does not result in a correct installation with OpenMP support enabled.
Here is the message upon installation:
Installing package into β/Users/dmitrysorokin/Documents/Projects/name_of_project/renv/library/R-4.1/x86_64-apple-darwin17.0β
(as βlibβ is unspecified)
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/data.table_1.14.2.tgz'
Content type 'application/x-gzip' length 2336276 bytes (2.2 MB)
==================================================
downloaded 2.2 MB
The message upon loading the library is the same as at the top of the post. My session info from the R Project that uses renv right after this step is
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] data.table_1.14.2
loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1 renv_0.14.0
I would appreciate any help! Thank you very much in advance.