Closed Diego-MX closed 7 years ago
Conda's R does not use Rtools, instead opting to use the MSYS2 mingw-w64 toolchain (they're both mingw-w64 toolchains though and pretty similar).
We now provide prebuilt readxl, so the easiest thing to do is just:
conda install -c r r-readxl
(and if you are using conda >= 4.3 then you don't even need -c r
anymore).
Otherwise, (and for other packages) to setup a dev-environment that works with R and devtools, please do the following from a cmd.exe shell in which your conda R environment is activated (or your root env if that's where you installed R/r-essentials):
conda install m2w64-toolchain m2-make r-devtools r-essentials
Then in R
:
library(devtools)
options(download.file.method = "wget")
install_github('hadley/readxl')
Sorry to comment on an old issue, but for anyone who lands here as I did, there are a few more steps.
you may need to install a few more of the msys2 & mingw64 conda packages like sed
, zip
, gzip
, tar
, texinfo
, diffutils
, and coreutils
. See R install & admin docs Appendix D on Windows Toolset: command line tools.
$ conda install m2-sed m2-zip m2-gzip m2-tar m2-texinfo m2-coreutils m2-diffutils
you may need to create a /tmp
directory to %LOCALAPPDATA%\Continuum\<anaconda | miniconda>\envs\<R-env>\Library\
you may need rsync
according to R docs, but it isn't yet included in msys2 channel
There's got to be a wiki or document somewhere that explains this, but I can't seem to find it. I bet a lot of people are installing Rtools and setting BINPREF
not realizing that this is unnecessary. The msys2 m2
and mingw-w64 m2w64
conda channels are a big win for Anaconda!
If you use conda skeleton cran
(which is part of conda-build
) then it will attempt to generate recipes that list their dependencies. It usually works pretty well.
rsync
is definitely something I wish I had added when I created the m2*
packages.
I could make a metapackage called r-rtools
that installs all these packages, what do you think?
I am also wondering whether to change install.packages()
so that it looks for an existing conda
package and failing that, uses conda skeleton cran
and then conda-build
and only uses the current codepath if both of these fail. It might be controversial but I think it would better serve our users than the current situation.
I think the r-rtools
idea is good, "rtools" was intuitively the first keyword I searched for on anaconda.org. Also having m2-rsync
would be useful for other packages like git-fat
that use it. Thanks for your response!
Hi,
i still have problems installing (non-anaconda) R packages which require compilation. I have installed the following anaconda R packages:
conda install -c r r-essentials r-devtools rstudio
conda install m2w64-toolchain m2-make m2-sed m2-zip m2-gzip m2-tar m2-texinfo m2-coreutils m2-diffutils
The example from above
library(devtools)
options(download.file.method = "wget")
install_github('hadley/readxl')
only yields
Downloading GitHub repo hadley/readxl@master
from URL https://api.github.com/repos/hadley/readxl/zipball/master
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.4 from http://cran.r-project.org/bin/windows/Rtools/.
Installation failed: Could not find build tools necessary to build readxl
pulling the source code and building from command line also fails:
git clone https://github.com/tidyverse/readxl.git
R CMD build readxl
* checking for file 'readxl/DESCRIPTION' ... OK
* preparing 'readxl':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to build vignettes
Warnung: Ausführung von Kommando '"C:/Users/thorsten/Anaconda3/lib/R/bin/x64/Rcmd.exe" INSTALL -l "C:\Users\thorsten\AppData\Local\Temp\RtmpkzFvtE\Rinst2ddc3dc2218b" --no-multiarch "C:/Users/thorsten/AppData/Local/Temp/RtmpkzFvtE/Rbuild2ddc3bdf5228/readxl"' ergab Status 1
-----------------------------------
* installing *source* package 'readxl' ...
** libs
rm -Rf readxl.dll RcppExports.o XlsWorkBook.o XlsWorkSheet.o XlsxWorkBook.o XlsxWorkSheet.o endian.o ole.o xls.o xlstool.o zip.o
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/Users/thorsten/ANACON~1/lib/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"C:/Users/thorsten/Anaconda3/Lib/R/library/Rcpp/include" -I"C:/swarm/workspace/External-R-3.4.3/vendor/extsoft/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
bash.exe: warning: could not find /tmp, please create!
/bin/sh: c:/Rtools/mingw_64/bin/g++: No such file or directory
C:/Users/thorsten/ANACON~1/lib/R/etc/x64/Makeconf:215: recipe for target 'RcppExports.o' failed
make: *** [RcppExports.o] Error 127
Warnung: Ausführung von Kommando 'make -f "Makevars.win" -f "C:/Users/thorsten/ANACON~1/lib/R/etc/x64/Makeconf" -f "C:/Users/thorsten/ANACON~1/lib/R/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="readxl.dll" WIN=64 TCLBIN=64 OBJECTS="RcppExports.o XlsWorkBook.o XlsWorkSheet.o XlsxWorkBook.o XlsxWorkSheet.o endian.o ole.o xls.o xlstool.o zip.o"' ergab Status 2
ERROR: compilation failed for package 'readxl'
* removing 'C:/Users/thorsten/AppData/Local/Temp/RtmpkzFvtE/Rinst2ddc3dc2218b/readxl'
In R CMD INSTALL
-----------------------------------
ERROR: package installation failed
So do i need to install Rtools from cran or is there an equivalent available in conda? And where exactly do i have to create the /tmp folder for base environment? The path from above didn't seem to work either
@zaphot please open a new issue instead of commenting on an issue that has already been closed.
@zaphot, I added some wikis with help on installing R packages from source or CRAN. Note I didn't use devtools or try to install from a clone, but if I grab the link from the CRAN readxl
webpage I can install it from R:
(py36r) Downloads>curl -Ok https://cran.r-project.org/src/contrib/readxl_1.0.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1890k 100 1890k 0 0 547k 0 0:00:03 0:00:03 --:--:-- 550k
(py36r) Downloads>R
R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> install.packages("readxl_1.0.0.tar.gz", repos=NULL, type="source")
* installing *source* package 'readxl' ...
** package 'readxl' successfully unpacked and MD5 sums checked
** libs
rm -Rf readxl.dll RcppExports.o XlsWorkBook.o XlsWorkSheet.o XlsxWorkBook.o XlsxWorkSheet.o endian.o init.o ole.o xls.o xlstool.o zip.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/g++ -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -march=x86-64 -mtune=generic -c RcppExports.cpp -o RcppExports.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/g++ -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -march=x86-64 -mtune=generic -c XlsWorkBook.cpp -o XlsWorkBook.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/g++ -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -march=x86-64 -mtune=generic -c XlsWorkSheet.cpp -o XlsWorkSheet.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/g++ -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -march=x86-64 -mtune=generic -c XlsxWorkBook.cpp -o XlsxWorkBook.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/g++ -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -march=x86-64 -mtune=generic -c XlsxWorkSheet.cpp -o XlsxWorkSheet.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/gcc -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -std=gnu99 -march=x86-64 -mtune=generic -c endian.c -o endian.o
endian.c: In function 'xlsConvertFormula':
endian.c:231:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
W_ENDIAN(*(WORD *)&f->resdata[1]);
^
endian.c:231:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/gcc -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -std=gnu99 -march=x86-64 -mtune=generic -c init.c -o init.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/gcc -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -std=gnu99 -march=x86-64 -mtune=generic -c ole.c -o ole.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/gcc -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -std=gnu99 -march=x86-64 -mtune=generic -c xls.c -o xls.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/gcc -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -std=gnu99 -march=x86-64 -mtune=generic -c xlstool.c -o xlstool.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/g++ -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/include" -DNDEBUG -Iwindows -I. -D__USE_MINGW_ANSI_STDIO -I"%LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/Rcpp/include" -I"%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/include" -O2 -Wall -march=x86-64 -mtune=generic -c zip.cpp -o zip.o
%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/bin/g++ -shared -s -o readxl.dll tmp.def RcppExports.o XlsWorkBook.o XlsWorkSheet.o XlsxWorkBook.o XlsxWorkSheet.o endian.o init.o ole.o xls.o xlstool.o zip.o -lRiconv -L%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/lib/x64 -L%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/../Library/mingw-w64/lib -L%LOCALAPPDATA%/CONTIN~1/ANACON~1/envs/py36r/R/bin/x64 -lR
installing to %LOCALAPPDATA%/Continuum/anaconda3/envs/py36r/R/library/readxl/libs/x64
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
converting help for package 'readxl'
finding HTML links ... done
cell-specification html
finding level-2 HTML links ... done
excel_sheets html
read_excel html
readxl-package html
readxl_example html
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (readxl)
>
hope this helps!
thanks for the answer! Unfortunately this didn't work. Therefore, i created a new issue: https://github.com/ContinuumIO/anaconda-issues/issues/9184
I have several issues installing R packages for Jupyter.
When I browse to that address, I do find the package is available.
Rcpp
and follow their solution (will not work 4 me)devtools
and dependencies to install them withinstall_github
,It seems like there's a bigger problem now with Rtools.
So it seems that I just shouldn't use
readxl
and go with another tool likeopenxlsx
. The reason why I think this is related to Anaconda is because I have another installation of R running locally on my computer, and it does install the packages as its supposed to, and I'm able to usereadxl
there. If someone else has similar issues, maybe it will be worth it to try to solve it.Cheers from Mexico.