22
votes

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?

10
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: 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
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, I'm not going to try upgrading until after an x.y.0 version of R is updated.Clarinetist

10 Answers

29
votes

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

10
votes

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

4
votes

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.

4
votes

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

It worked for me.

3
votes

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..

2
votes

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..

1
votes

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.

0
votes

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.

0
votes

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()
packagedata.table’ successfully unpacked and MD5 sums checked
> library(data.table)
Error: package or namespace load failed fordata.table’:
 packagedata.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

0
votes

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.