peculiar installation warning causing packages to

2019-07-07 07:06发布

问题:

I want to install the package xgboost in R as per the instructions:

install.packages("drat", repos="https://cran.rstudio.com")
drat:::addRepo("dmlc")
install.packages("xgboost", repos="http://dmlc.ml/drat/", type = "source")

The installation of the first two packages seems to work fine:

install.packages("drat", repos="https://cran.rstudio.com")
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  0 49369    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0100 49369  100 49369    0     0  40981      0  0:00:01  0:00:01 --:--:-- 41004

The downloaded binary packages are in
    /var/folders/sx/c5z57jp103s493xxcn9bhvwc0000gn/T//RtmpluolUL/downloaded_packages

drat:::addRepo("dmlc")

But the final installation of xgboost is really irregular and I couldn't fid the error in a previous post:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0100  351k  100  351k    0     0   550k      0 --:--:-- --:--:-- --:--:--  550k
* installing *source* package ‘xgboost’ ...
** libs
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include     -fPIC  -Wall -mtune=core2 -g -O2 -c xgboost_R.cc -o xgboost_R.o
In file included from xgboost_R.cc:3:
./dmlc-core/include/dmlc/omp.h:13:9: warning: Warning: OpenMP is not available, project will be compiled into single-thread code. Use OpenMP-enabled compiler to get benefit of multi-threading. [-W#pragma-messages]
#pragma message("Warning: OpenMP is not available, "                    \
        ^
1 warning generated.
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include     -fPIC  -Wall -mtune=core2 -g -O2 -c xgboost_custom.cc -o xgboost_custom.o
In file included from xgboost_custom.cc:5:
In file included from ./include/xgboost/logging.h:13:
In file included from ./include/xgboost/./base.h:10:
./dmlc-core/include/dmlc/omp.h:13:9: warning: Warning: OpenMP is not available, project will be compiled into single-thread code. Use OpenMP-enabled compiler to get benefit of multi-threading. [-W#pragma-messages]
#pragma message("Warning: OpenMP is not available, "                    \
        ^
1 warning generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include    -fPIC  -Wall -mtune=core2 -g -O2  -c xgboost_assert.c -o xgboost_assert.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include     -fPIC  -Wall -mtune=core2 -g -O2 -c amalgamation/xgboost-all0.cc -o amalgamation/xgboost-all0.o
In file included from amalgamation/xgboost-all0.cc:13:
In file included from amalgamation/../src/metric/metric.cc:6:
In file included from ./include/xgboost/metric.h:14:
In file included from ./include/xgboost/./data.h:15:
In file included from ./include/xgboost/./base.h:10:
./dmlc-core/include/dmlc/omp.h:13:9: warning: Warning: OpenMP is not available, project will be compiled into single-thread code. Use OpenMP-enabled compiler to get benefit of multi-threading. [-W#pragma-messages]
#pragma message("Warning: OpenMP is not available, "                    \
        ^
1 warning generated.
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include     -fPIC  -Wall -mtune=core2 -g -O2 -c amalgamation/dmlc-minimum0.cc -o amalgamation/dmlc-minimum0.o
In file included from amalgamation/dmlc-minimum0.cc:8:
amalgamation/../dmlc-core/src/io/input_split_base.cc:26:22: warning: assigning field to itself [-Wself-assign-field]
  this->align_bytes_ = align_bytes_;
                     ^
In file included from amalgamation/dmlc-minimum0.cc:10:
In file included from amalgamation/../dmlc-core/src/data.cc:12:
In file included from amalgamation/../dmlc-core/src/data/disk_row_iter.h:19:
In file included from amalgamation/../dmlc-core/src/data/./libsvm_parser.h:13:
In file included from amalgamation/../dmlc-core/src/data/./text_parser.h:11:
./dmlc-core/include/dmlc/omp.h:13:9: warning: Warning: OpenMP is not available, project will be compiled into single-thread code. Use OpenMP-enabled compiler to get benefit of multi-threading. [-W#pragma-messages]
#pragma message("Warning: OpenMP is not available, "                    \
        ^
2 warnings generated.
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include     -fPIC  -Wall -mtune=core2 -g -O2 -c rabit/src/engine_empty.cc -o rabit/src/engine_empty.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I./include -I./dmlc-core/include -I./rabit/include -I. -DXGBOOST_STRICT_R_MODE=1 -DDMLC_LOG_BEFORE_THROW=0 -DDMLC_ENABLE_STD_THREAD=0 -DDMLC_DISABLE_STDIN=1 -DDMLC_LOG_CUSTOMIZE=1 -DXGBOOST_CUSTOMIZE_LOGGER=1 -DRABIT_CUSTOMIZE_MSG_ -DRABIT_STRICT_CXX98_ -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include     -fPIC  -Wall -mtune=core2 -g -O2 -c rabit/src/c_api.cc -o rabit/src/c_api.o
clang++ -std=c++11 -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 xgboost.so ./xgboost_R.o ./xgboost_custom.o ./xgboost_assert.o ./amalgamation/xgboost-all0.o ./amalgamation/dmlc-minimum0.o ./rabit/src/engine_empty.o ./rabit/src/c_api.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/xgboost/libs
** R
** data
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (xgboost)

The downloaded source packages are in
    ‘/private/var/folders/sx/c5z57jp103s493xxcn9bhvwc0000gn/T/RtmpluolUL/downloaded_packages’

The package does not download properly and hence it gives the following error when I try to run xgboost on a dataset:

Error in xgb.DMatrix(data, label = label, missing = missing) : 
  [14:53:26] amalgamation/../dmlc-core/src/io/local_filesys.cc:61: LocalFileSystem.GetPathInfo 201-225 Error:No such file or directory

回答1:

According to this post, you should "double check if you have provided all numeric type features to xgb.DMatrix function" when you see this error. Solved the issue for me.



回答2:

Try closing R then deleting your current library folder for it and re-installing it this way:

if(!require("pacman")) install.packages("pacman")
pacman::p_load(xgboost)

pacman, which is a portmanteau of Package Manager, gives you a package manager to manage the package installation instead of trying to install something manually. This is (more or less) the same reason people are use app stores or programs like gdebi (which grabs dependencies for you during Debian/Ubuntu installations) more and more instead of manually building programs from scratch after downloading some of the source from some mirror or dev site.

It makes sure you have all the dependencies, checks versions, checks the installation, tests the loading of the package, has automated troubleshooting steps, etc.