When calling install.packages("tm") I get the following error:
> install.packages("tm")
Installing package into ‘/usr/local/lib/R/3.3/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://ftp.cixug.es/CRAN/src/contrib/tm_0.7.tar.gz'
Content type 'application/x-gzip' length 526498 bytes (514 KB)
==================================================
downloaded 514 KB
* installing *source* package ‘tm’ ...
** package ‘tm’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
clang -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c copy.c -o copy.o
clang -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c init.c -o init.o
clang++ -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -I"/usr/local/lib/R/3.3/site-library/BH/include" -I"/usr/local/lib/R/3.3/site-library/Rcpp/include" -fPIC -g -O2 -c tdm.cpp -o tdm.o
In file included from tdm.cpp:4:
/usr/local/lib/R/3.3/site-library/BH/include/boost/tokenizer.hpp:59:9: error: field of type 'std::__1::__wrap_iter<const char *>' has private constructor
: first_(c.begin()), last_(c.end()), f_() { }
^
tdm.cpp:25:28: note: in instantiation of function template specialization 'boost::tokenizer<boost::char_delimiters_separator<char, std::__1::char_traits<char> >, std::__1::__wrap_iter<const char *>, std::__1::basic_string<char> >::tokenizer<Rcpp::internal::const_string_proxy<16> >' requested here
boost::tokenizer<> tok(strings(index));
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:1239:31: note: declared private here
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
^
In file included from tdm.cpp:4:
/usr/local/lib/R/3.3/site-library/BH/include/boost/tokenizer.hpp:59:28: error: field of type 'std::__1::__wrap_iter<const char *>' has private constructor
: first_(c.begin()), last_(c.end()), f_() { }
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:1239:31: note: declared private here
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
^
2 errors generated.
make: *** [tdm.o] Error 1
ERROR: compilation failed for package ‘tm’
* removing ‘/usr/local/lib/R/3.3/site-library/tm’
Warning in install.packages :
installation of package ‘tm’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/02/6mkk426d3jd46mg35j577bwc0000gn/T/RtmpHPgAoU/downloaded_packages’
My computer runs macOS Sierra. The output of sessionInfo() is:
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin16.3.0 (64-bit)
Running under: macOS Sierra 10.12.3
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 utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.2
I didn't have problems installing "slam" as other posts mentioned. I have also tried installing "tm" with the dependencies flag set to TRUE but yields the same output. I installed R via homebrew. I wonder if there are any other steps I can try.
I've been having the same issue. For now, I've installed tm 0.6 from the cran.r-project website. This eliminated the compilation errors for me.
Related
Installing a package from source fails for me on my windows machine. I uninstalled RStudio, R and deleted rtools40 folder, restarted and reinstalled those items. I believe I have the path set up appropriately.
Here's the code I tried, using some troubleshooting help from here:
#troubleshooting installation
pkgbuild::find_rtools()
pkgbuild::has_rtools(TRUE)
pkgbuild::check_rtools(TRUE)
pkgbuild::rtools_path()
pkgbuild::check_build_tools(TRUE)
pkgbuild::check_compiler(TRUE)
Sys.getenv("PATH")
Sys.getenv('BINPREF')
sessionInfo()
#Test installation from source via CRAN
pkgbuild::with_build_tools(install.packages("lme4", type = "source"))
And here is the output:
Restarting R session...
> #troubleshooting installation
> pkgbuild::find_rtools()
[1] TRUE
> pkgbuild::has_rtools(TRUE)
[1] TRUE
> pkgbuild::check_rtools(TRUE)
[1] TRUE
> pkgbuild::rtools_path()
[1] "C:\\rtools40/usr/bin"
> pkgbuild::check_build_tools(TRUE)
Your system is ready to build packages!
> pkgbuild::check_compiler(TRUE)
Trying to compile a simple C file
Running "C:/PROGRA~1/R/R-40~1.3/bin/x64/Rcmd.exe" SHLIB foo.c
Warning message:
In system(cmd) : 'make' not found
Error: Failed to compile C code
> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-4.0.3\\bin\\x64;C:\\rtools40\\bin;C:\\rtools40\\mingw64\\bin;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Pandoc\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Users\\nealm\\AppData\\Local\\Microsoft\\WindowsApps;C:\\ProgramData\\Anaconda3;C:\\ProgramData\\Anaconda3\\Scripts;C:\\Users\\nealm\\.conda\\pkgs\\conda-4.7.5-py37_0\\Scripts;C:\\ProgramData\\Anaconda3\\Library\\bin;C:\\Users\\nealm\\AppData\\Local\\GitHubDesktop\\bin;C:\\Users\\nealm\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\nealm\\AppData\\Roaming\\TinyTeX\\bin\\win32;"
> Sys.getenv('BINPREF')
[1] "C:/rtools40/mingw64/bin/"
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252 LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] processx_3.4.5 compiler_4.0.3 assertthat_0.2.1 R6_2.5.0 cli_2.2.0 livecode_0.1.0.9000
[7] prettyunits_1.1.1 tools_4.0.3 glue_1.4.2 rstudioapi_0.13 Rcpp_1.0.5 remotes_2.2.0
[13] crayon_1.3.4 fansi_0.4.1 callr_3.5.1 ps_1.4.0 pkgbuild_1.1.0
>
> #Test installation from source via CRAN
> pkgbuild::with_build_tools(install.packages("lme4", type = "source"))
Installing package into ‘C:/Rpackages’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/lme4_1.1-26.tar.gz'
Content type 'application/x-gzip' length 3297635 bytes (3.1 MB)
downloaded 3.1 MB
* installing *source* package 'lme4' ...
** package 'lme4' successfully unpacked and MD5 sums checked
** using staged installation
** libs
*** arch - i386
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c external.cpp -o external.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c glmFamily.cpp -o glmFamily.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c optimizer.cpp -o optimizer.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c predModule.cpp -o predModule.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c respModule.cpp -o respModule.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o lme4.dll tmp.def external.o glmFamily.o optimizer.o predModule.o respModule.o -LC:/PROGRA~1/R/R-40~1.3/bin/i386 -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-40~1.3/bin/i386/R.dll when searching for -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-40~1.3/bin/i386/R.dll when searching for -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lR
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'lme4'
* removing 'C:/Rpackages/lme4'
* restoring previous 'C:/Rpackages/lme4'
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\nealm\AppData\Local\Temp\RtmpwPwykm\downloaded_packages’
>
The problem does not appear to be specific to the lme4 package.
This is more of a work around than a proper answer. The alternative to installing and building from source is to install a pre-built binary. If one is not available, you can build it remotely.
In this case, for the package of interest for me, rundel/livecode on github, I:
Forked the repo (in this case rundel/livecode). This step might be optional.
Downloaded the tar.gz (remotes::install_github("markbneal/livecode") which doesn't install it, but the error tells you where it saves the .tar.gz file locally.
Used rhub to build the package binary for windows, go to this website https://builder.r-hub.io/ and upload your tar.gz file, ensuring rhub has your email address (click "advanced" button to provide your email address as alternate - you will need to validate it). That emails me a zip 5 minutes later.
Then copy the livecode folder in the zip that is emailed to me to my "R packages" folder location.
Package should now work for you, in my case library(livecode)
Edited six months later when I had to use this process again!
I'm trying to install reticulate so I can execute some Python code I've written from within R. Unfortunately, I'm having trouble installing the package and haven't had much luck in determining the reason.
I've found that it likely has something to do with compiling the package and possible issues with gcc or different versions of c++ compilers, but I'm a bit out of my depth with those issues and haven't been able to get anything working. I've tried uninstalling and reinstalling xcode command line tools, but that didn't solve the issue. Beyond that, I'm not entirely sure where to start. I'm hoping somebody has experienced this and there's a straightforward answer, I'd really appreciate any help.
> install.packages('reticulate')
There is a binary version available but the source version is later:
binary source needs_compilation
reticulate 1.13 1.14 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) y
installing the source package ‘reticulate’
trying URL 'https://cran.rstudio.com/src/contrib/reticulate_1.14.tar.gz'
Content type 'application/x-gzip' length 1504849 bytes (1.4 MB)
==================================================
downloaded 1.4 MB
* installing *source* package ‘reticulate’ ...
** package ‘reticulate’ successfully unpacked and MD5 sums checked
** libs
/usr/local/bin/gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
/usr/local/bin/gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c event_loop.cpp -o event_loop.o
/usr/local/bin/gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c libpython.cpp -o libpython.o
/usr/local/bin/gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c output.cpp -o output.o
/usr/local/bin/gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c python.cpp -o python.o
/usr/local/bin/gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c readline.cpp -o readline.o
/usr/local/bin/gcc-8 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o reticulate.so RcppExports.o event_loop.o libpython.o output.o python.o readline.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.5/Resources/library/reticulate/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘reticulate’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/reticulate/libs/reticulate.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/reticulate/libs/reticulate.so, 6): Symbol not found: __ZNSt15basic_streambufIcSt11char_traitsIcEE5imbueERKSt6locale
Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/reticulate/libs/reticulate.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/3.5/Resources/library/reticulate/libs/reticulate.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/reticulate’
Warning in install.packages :
installation of package ‘reticulate’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/4g/ctbqp07114x4brzp4hr8zfc40000gn/T/RtmpDNvElq/downloaded_packages’
Session Info:
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.15.2
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/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 utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.3 tools_3.5.3 yaml_2.2.0
Okay, I suggest to use conda to create a new environment and install there R anew. Because then you solve the issues - since only one line conda install -c conda-forge r-reticulate will install you reticulate and r-base solving for you all issues.
However some people (who don't know what conda is) won't be happy with my suggestion. I can't and won't help them.
But for those who know conda, I recommend:
conda create --name R_reticulate
source activate R_reticulate
conda install -c conda-forge r-reticulate
(of course you could determine version numbers when installing into conda environment ...)
if the version of R in your local env now is the same like your global R, you can even overtake most of the library installed in the pre-existing R - thus you don't have to reinstall them all over again. Simply by manipulating the path variable in your conda env's R.
(Just as a hack and if you are lazy to install everything anew, probably because you want just to play around with reticulate first, before you install it into your global R).
For that, in your global R, determine where your R packages are installed by .libPaths() from within your global R console.
Then start R in your R_reticulate conda environment,
and at beginning of session do
my_libPaths <- .libPaths()
# and e.g. add one or some of your global .libPaths() paths
# to here by
my_libPaths <- c(my_libPaths, one_of_global_path)
.libPaths(my_libPaths) # assign new libpaths!
# the order of the paths in the vector is important - decides about where R looks first!
# of course you can change order like you want in the vector!
By that, you don't have to re-install libraries.
However, the version number of global and local (conda) R must be same so that this works.
Otherwise you will get always warnings when loading libraries ...
Simpler is of course to re-install everything into your conda env's R. (conda will help you for this a lot!).
UPDATE - Problem solved:
It seems like the way I set up .libPaths() (see comments below) loaded dplyr from a network directory, which somehow blocked the installation process of purrr. As soon as I installed and loaded dplyr from my local library I could install purrr.
I tried installing purrr from a local version of the package (purrr_0.2.2.tar.gz; see CRAN website). My installation attempt returns an error (fatal error: dplyr.h: No such file or directory):
> install.packages("H:/R_packages/purrr_0.2.2.tar.gz", # directory of the downloaded file
+ repos = NULL,
+ type = c("source"),
+ INSTALL_opts = "--no-test-load",
+ lib = "H:/R_packages") # where to install the package
'\\userhome\ABCD1234'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'purrr' ...
** package 'purrr' successfully unpacked and MD5 sums checked
** libs
gcc -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath//R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c extract.c -o extract.o
g++ -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -mtune=core2 -c fast-copy.cpp -o fast-copy.o
gcc -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c flatten.c -o flatten.o
gcc -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c map.c -o map.o
g++ -m64 -I"C:/R/R-3.2.1/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"H:/R_packages/Rcpp/include" -I"\\mypath/R/Lib/CRAN/3.2/dplyr/include" -I"H:/R_packages/BH/include" -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -mtune=core2 -c rows-data.cpp -o rows-data.o
rows-data.cpp:2:19: fatal error: dplyr.h: No such file or directory
compilation terminated.
make: *** [rows-data.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/R/R-3.2.1/etc/x64/Makeconf" -f "C:/R/R-3.2.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="purrr.dll" WIN=64 TCLBIN=64 OBJECTS="extract.o fast-copy.o flatten.o map.o rows-data.o rows-formatter.o rows.o transpose.o utils.o vector.o"' had status 2
ERROR: compilation failed for package 'purrr'
* removing 'H:/R_packages/purrr'
Warning in install.packages :
running command '"C:/R/R-3.2.1/bin/x64/R" CMD INSTALL --no-test-load -l "H:\R_packages" "H:/R_packages/purrr_0.2.2.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘H:/R_packages/purrr_0.2.2.tar.gz’ had non-zero exit Status
I used the same approach for a lot of other packages (broom, modelr, forcats etc.), and it always worked. Does anybody have an idea why the package installation fails in this particular case?
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252
[4] LC_NUMERIC=C LC_TIME=German_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.4.2
loaded via a namespace (and not attached):
[1] magrittr_1.5 R6_2.1.0 assertthat_0.1 parallel_3.2.1 DBI_0.3.1 tools_3.2.1 Rcpp_0.12.0
I want to install Rcpp using install.packages("Rcpp"), but it failed.
The error message:
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c Date.cpp -o Date.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c Module.cpp -o Module.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c Rcpp_init.cpp -o Rcpp_init.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c api.cpp -o api.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c attributes.cpp -o attributes.o
g++ -I/usr/local/lib64/R/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fpic -g -O2 -c barrier.cpp -o barrier.o
g++ -shared -L/usr/local/lib64 -o Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o
installing to /home/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/Rcpp/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/Rcpp/libs/Rcpp.so':
/home/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/Rcpp/libs/Rcpp.so: undefined symbol: _ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffExSt12_Ios_SeekdirSt13_Ios_Openmode
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/sethbrin/R/x86_64-redhat-linux-gnu-library/3.1/Rcpp’
The downloaded source packages are in
‘/tmp/Rtmp6PKB8N/downloaded_packages’
Warning message:
In install.packages("Rcpp") :
installation of package ‘Rcpp’ had non-zero exit status
Then I use
c++fit _ZNSt15basic_streambufIcSt11char_traitsIcEE7seekoffExSt12_Ios_SeekdirSt13_Ios_Openmode
std::basic_streambuf<char, std::char_traits<char> >::seekoff(long long, std::_Ios_Seekdir, std::_Ios_Openmode)
I have searched for some solutions for that. It seems that it is because of the gcc version. But I don't know how to change the gcc version that R uses to compile Rcpp package.
CRAN tests Rcpp just like any other of the (by now) 6700+ package.
You can see the aggregate test report and the test setups includes two Fedora-based machines:
one fedora setup using clang and
one fedora setup using g++.
As such your problems are possibly local, or simply due to using an older setup. In which case the Archive section gives you access to an older version.
I've encountered a similar problem.
And after some searches, here are the solutions to alter the compiler:
1. If you have the root privilege:
I found that the Makeconf file in R directory actually sets all the information that is needed for compilation.
To find the path to it, echo which R in the command line.
e.g. I got like:
/data/apps/R/3.1.2/bin/R
And then the file is in:
/data/apps/R/3.1.2/lib64/R/etc/Makeconf
then sudo edit the file on line CC = XXX and maybe more relative lines.
Problem solved!
2. If you only have local user privilege.
Add your own configurations to ~/.R/Makevars
However, #Dirk is probably right.
For me, I finally solved my problem by adding -Doff_t=__off_t to CFLAGS (My problem was error: unknown type name 'off_t'). And I got the halted error when I manually altered parts of the compilers...
I'm unable to install several R packages because they always fail on the first include statement. This is the error I get for Rcpp:
install.packages("/Users/nacho/Downloads/Rcpp_0.10.3.tar.gz", repos=NULL, type="source")
Installing package(s) into ‘/Users/nacho/Library/R/2.15/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
c++ -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c Date.cpp -o Date.o
clang: warning: argument unused during compilation: '-fopenmp'
clang: warning: argument unused during compilation: '-fopenmp'
Date.cpp:29:10: fatal error: 'Rcpp/Datetime.h' file not found
#include <Rcpp/Datetime.h>
^
1 error generated.
make: *** [Date.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/Users/nacho/Library/R/2.15/library/Rcpp’
Warning message:
In install.packages("/Users/nacho/Downloads/Rcpp_0.10.3.tar.gz", :
installation of package ‘/Users/nacho/Downloads/Rcpp_0.10.3.tar.gz’ had non-zero exit status
I get the same error for RJSONIO
install.packages("/Users/nacho/Downloads/RJSONIO_1.0-3.tar.gz", repos=NULL, type="source")
Installing package(s) into ‘/Users/nacho/Library/R/2.15/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘RJSONIO’ ...
** package ‘RJSONIO’ successfully unpacked and MD5 sums checked
Trying to find libjson.h header file
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
USE_LOCAL = ""
Minor Version: 6
Using local libjson code. Copying files from src/libjson/Source
/private/var/folders/tl/_8_djcq15pl01ht8z6hy9tww0000gn/T/RtmpMKCuPF/R.INSTALL116ed562675dc/RJSONIO
JSONAllocator.cpp
JSONChildren.cpp
JSONDebug.cpp
JSONIterators.cpp
JSONMemory.cpp
JSONNode.cpp
JSONNode_Mutex.cpp
JSONPreparse.cpp
JSONStream.cpp
JSONValidator.cpp
JSONWorker.cpp
JSONWriter.cpp
internalJSONNode.cpp
libjson.cpp
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating cleanup
** libs
cc -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c ConvertUTF.c -o ConvertUTF.o
clang: warning: argument unused during compilation: '-fopenmp'
clang: warning: argument unused during compilation: '-fopenmp'
c++ -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG -fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c JSONAllocator.cpp -o JSONAllocator.o
clang: warning: argument unused during compilation: '-fopenmp'
clang: warning: argument unused during compilation: '-fopenmp'
JSONAllocator.cpp:1:10: fatal error: 'JSONAllocator.h' file not found
#include "JSONAllocator.h"
^
1 error generated.
make: *** [JSONAllocator.o] Error 1
ERROR: compilation failed for package ‘RJSONIO’
* removing ‘/Users/nacho/Library/R/2.15/library/RJSONIO’
Warning message:
In install.packages("/Users/nacho/Downloads/RJSONIO_1.0-3.tar.gz", :
installation of package ‘/Users/nacho/Downloads/RJSONIO_1.0-3.tar.gz’ had non-zero exit status
My sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin11.4.2 (64-bit)
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] graphics grDevices utils datasets stats grid methods base
other attached packages:
[1] clickme_0.0.3 ggplot2_0.9.3.1 testthat_0.7.1 devtools_1.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-1 dichromat_2.0-0 digest_0.6.3 evaluate_0.4.3 formatR_0.7 gtable_0.1.2
[7] httr_0.2 knitr_1.1 labeling_0.1 MASS_7.3-23 memoise_0.1 munsell_0.4
[13] parallel_2.15.2 plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5 RCurl_1.95-4.1 reshape2_1.2.2
[19] scales_0.2.3 stringr_0.6.2 tools_2.15.2 whisker_0.1 yaml_2.1.7
What happens when you try
R CMD INSTALL Rcpp_0.10.3.tar.gz
instead? From the log you show:
c++ -I/usr/local/Cellar/r/2.15.2/R.framework/Resources/include -DNDEBUG \
-fopenmp -I/usr/local/include -fopenmp -fPIC -g -O2 -c Date.cpp -o Date.o
it is clear that you are missing something. On my Linux box (and you can ignore the
fact that I use the current SVN version)
edd#max:~/svn/rcpp/pkg$ R CMD INSTALL Rcpp_0.10.3.1.tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘Rcpp’ ...
** libs
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG -I../inst/include/ \
-fpic -g0 -O3 -Wall -pipe -Wno-variadic-macros -pedantic -c Date.cpp -o Date.o
Notice the -I../inst/include here? Maybe you overwrote CXXFLAGS or something...