22

I am currently using R 3.5 (beta version) and I need data.table package in my project but my package does not install. Can anyone help me in the case. It shows me following errors when i install it.

install.packages("data.table") Installing package into ‘C:/Users/hp/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘data.table’ These will not be installed

I had also tried to install the package data.table_1.10.4-3.zip using CRAN repository. but it shows following errors.

install.packages("C:/Users/hp/Downloads/data.table_1.10.4-3.zip", repos = NULL, type = "win.binary") Installing package into ‘C:/Users/hp/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified) package ‘data.table’ successfully unpacked and MD5 sums checked library(data.table) Error: package or namespace load failed for ‘data.table’: package ‘data.table’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version

Can anyone help me? What should I do?

nicola
  • 24,005
  • 3
  • 35
  • 56
Rishabh Raj
  • 221
  • 1
  • 2
  • 3
  • 4
    Why are you using a beta version of R? You should definitely use a stabler version. Anyway, you could try downloading the data.table tarball (here: https://cran.r-project.org/src/contrib/data.table_1.10.4-3.tar.gz) and try `install.packages("path/to/datatabletarball",repos=NULL,type="source")` (this might fail under windows if you don't have the needed tools). – nicola Apr 15 '18 at 05:38
  • R 3.5 is no longer in beta, but `data.table` installation is still not successful. Long story short, I downgraded to R 3.4.3. Per a [comment I read](https://github.com/Rdatatable/data.table/issues/2793#issuecomment-384360544), I'm not going to try upgrading until after an x.y.0 version of R is updated. – Clarinetist May 01 '18 at 18:56

10 Answers10

29

Update: data.table 1.11.0 was accepted on CRAN 1st May 2018. CRAN binaries should now start to update over the next few days.


Previous answer:

data.table 1.10.4-3 (Oct 2017) has been in error status for some months on CRAN which prevents the binaries being made available, very reasonably. We have fixed the problems in dev in good time months ago and just need to get the next release to CRAN. It is not a problem of CRAN or of R 3.5.0, per se.

In the meantime, could you use Windows.zip binary from dev? It is compiled for you and you don't need any tools. This dev version 1.10.5 is what will be renamed to 1.11.0 on CRAN. There is nothing in it that won't be in 1.11.0 so there is no addition risk, other than it not actually being on CRAN yet.

https://twitter.com/MattDowle/status/976890741543677952

enter image description here

Matt Dowle
  • 58,872
  • 22
  • 166
  • 224
  • 1
    I installed using the above suggestion. I receive this error - `package ‘data.table’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version`. Any other way available? I use R 3.5.0 version btw. – Naive_Natural2511 Apr 26 '18 at 10:48
  • 3
    Thanks for letting me know! I just checked and "R-release" on AppVeyor is still R 3.4.4 since R 3.5 was only released a few days ago. I don't know how long AppVeyor CI takes to update but if it's still a problem in a week, please let me know. In the meantime, click the R_VERSION=devel one (instead of the R_VERSION=release) and that should work. Please reply either way so others here know as well. – Matt Dowle Apr 26 '18 at 17:29
  • Where is the website for this? http://r-datatable.com/ is giving me a 500 internal server error. – sharoz May 01 '18 at 17:08
  • 2
    @sharoz Frustratingly, that domain is having trouble. I've raised a ticker with the domain provider (who has been bought by another one). It just forwards to : https://github.com/Rdatatable/data.table/wiki – Matt Dowle May 01 '18 at 20:13
10

It seems that in Windows, prior RTools versions (sometimes?) installed to the directory C:\\RBuildTools, instead of the proper C:\\RTools directory, and this is causing problems. With R 3.5.0, RTools is needed to load the data.table package from source.

RTools35.exe IS compatable with R 3.5.0 and will install data.table once it is installed correctly. I'm using the CRAN versions of data.table and R 3.5.0.

I finally got data.table to install by fixing the RTools installation and PATH:

  1. uninstall RTools

  2. MANUALLY removing the old C:\\RBuildTools directory from the PATH

  3. (re)installing RTools35 to C:\\RTools directory. (make sure to choose the "add to path" option.

  4. double check in R that the new directory (c:\\Rtools\\bin) is in the PATH by running the command in R Sys.getenv("PATH").

see this RStudio Communitydiscussion which was helpful in figuring this out.

and also several suggestions filed under an issue on data.table github issues especially one nicely spelled out by JoeFernando

Matt L.
  • 2,753
  • 13
  • 22
  • RTools has had a default install dir of `c:\Rtools` for a very long time. If you had it installed in `c:\RBuildTools`, it's likely because you overrode the defaults. – user2554330 Apr 26 '18 at 22:04
  • Apparently this was the default directory at some point, maybe just in windows?...I've seen other references to this as well, and I don't think that I would have changed this (although it was a long time ago that I installed). Regardless, it caused a major issue and its fixed now. – Matt L. Apr 26 '18 at 22:26
  • Here's a whole post on it- seems to be caused by the wrong default directory at: https://statbandit.wordpress.com/2017/07/20/quirks-about-running-rcpp-on-windows-through-rstudio/ – Matt L. Apr 26 '18 at 22:29
  • and involved in another SO question: https://stackoverflow.com/questions/28376337/error-installing-and-running-rcpp – Matt L. Apr 26 '18 at 22:33
  • it's possible that I originally used `installr::install.Rtools()` to install it. This could have overridden the default directory? – Matt L. Apr 26 '18 at 22:36
  • Never used `installr`, but it could certainly have overridden the RTools defaults. – user2554330 Apr 26 '18 at 23:44
  • 3
    This is related to finding the correct mingw toolchains. If you don't install in the default directory, you need to set BINPREF as explained here : https://stat.ethz.ch/pipermail/r-devel/2018-February/075572.html – Joris Meys Apr 30 '18 at 19:22
  • I finally could install data.table by reinstalling `Rtools` following these instructions: https://stackoverflow.com/questions/50034966/no-rtools-compatible-with-r-version-3-5-0-was-found. It works only after copying the lines on the editing system path step – Santi XGR Jun 29 '18 at 19:12
4

R 3.5 is currently in pre-release. If you look at the data.table page https://cran.r-project.org/web/packages/data.table/index.html at the time being the data.table package has not been compiled for R 3.5 on windows. Thus you cannot install it with 3.5. Maybe you can compile it yourself. But if the CRAN did not make a windows binary for the R 3.5 maybe something went wrong.

The new R version seems to have some major internal changes. Thus, when you tried to install a previous data.table version compiled for R 3.4, R 3.5 told you that you can't.

You should really use the stable R 3.4 for now.

Edit on April 25th 2018: R 3.5 is now released. But the data.table package is still unavailable for R 3.5.

JRR
  • 3,024
  • 2
  • 13
  • 37
4

To elaborate more on Matt Dowle's answer in case someone is less familiar with the procedure:

It worked for me.

Xing Zhang
  • 175
  • 1
  • 5
3

The GitHub for data.table has directions to a daily-build windows binary of data.table https://github.com/Rdatatable/data.table/wiki/Installation

this is the answer given by Jaap in another thread, and it works for me..

tom 2
  • 334
  • 2
  • 3
2

As of 4/30, this issue was still happening to me in R 3.5.0. Here is what worked for me:

Somehow this last line did not work for me, I installed the data.table_1.10.4-3.zip manually Also, a point, make sure that the RTools previous version is properly uninstalled so as to clean it from system. (through the unins file in its installed directory) Or else the RTools whichyou are trying to install will keep going back to the older directory and not in C:\RTools..

Finally I could get this working..

ice1000
  • 6,406
  • 4
  • 39
  • 85
user5577796
  • 221
  • 2
  • 4
1

I also had the same problem, and found that RTools was not properly installed: I downloaded RTools35.exe and it was trying to install in 3.4 folder. When I changed the path to the R3.5 folder, everything worked.

Omry Atia
  • 2,411
  • 2
  • 14
  • 27
  • Rtools should not be installed in an R folder. It's a bunch of tools used to build R and R packages, it's not part of R. – user2554330 Apr 26 '18 at 21:57
0

As of Tuesday April 24, data.table binaries on CRAN don't install on MSwin for R-3.5.0. Unfortunately, downloading and building from source fails with Rtools 3.3, 3.4, and 3.5.

devtools::install_github("Rdatatable/data.table") works with Rtools3.4 but not Rtools3.5. That installs data.table_1.10.5

Normally I'd just follow the directions and wait 2-3 days after a new release of R before grabbing binaries of the packages I use from CRAN, but I needed a fix in R-3.5.0 and needed a package that depends on data.table. EDIT April 25: The above was on win10. On win7, neither Rtools3.5 nor Rtools3.4 worked with the github version. See solution posted separately.

tom 2
  • 334
  • 2
  • 3
0

The GitHub for data.table has directions to a daily-build windows binary of data.table https://github.com/Rdatatable/data.table/wiki/Installation

this is the answer given by Jaap in another thread,

Unlike the above, it does not work for me...

> utils:::menuInstallLocal()
package ‘data.table’ successfully unpacked and MD5 sums checked
> library(data.table)
Error: package or namespace load failed for ‘data.table’:
 package ‘data.table’ was installed by an R version with different  internals; it needs to be reinstalled for use with this R version

I'll wait this one out for a bit and hopefully it will sort out. fortunately I've nothing mission critical

AJP
  • 1
  • 4
0

I had a similar problem. It turns out that there is a bug in (the Windows version of) RTools35.exe. The installer screen offers the default installation directory C:/Rtools, but if you accept this it actually installs into C:/RBuildTools.

I solved the problem as follows:

  1. Uninstall the RBuildTools installation
  2. Create a new directory C:/Rtools
  3. Install Rtools35 again, browsing to the Rtools directory to choose the installation directory
  4. Add C:/Rtools to the windows PATH environment variable

Restart R/Studio, then

library(devtools) 
devtools::find_rtools() 

should now return TRUE.

This fix enabled me to install certain git-hub packages that were throwing all sorts of errors when Rtools was installed to the wrong directory.

Garry
  • 179
  • 13