Comments (34)
Here's what we're doing with our students who need ranger
: we issue a bash script called rangerinstall.sh
containing the following, which we have them execute:
#!/bin/bash
sed -i -e '$aCXX = g++ -std=gnu++14' ~/.R/Makevars
R -e 'install.packages("ranger",repos="https://cloud.r-project.org/")'
sed '$d' ~/.R/Makevars
All of our students are RStudio Server users, so executing this via the Terminal...
from ranger.
I am having the same problem in Debian linux, R 4.04
Adding the aforementioned line Makevars worked!
from ranger.
The problem is that it tries to compile with -std=gnu++11
, which shouldn't be included. Do you have something in your local Makevars file, e.g. in ~/.R/Makevars
?
from ranger.
I was coming to write about this same issue, too. I am running into similar errors on Windows. Is there a ~/.R/Makevars
on a Windows machine?
My errors look like
C:/Users/AnthonySchmidt/Documents/R/win-library/4.1/RcppEigen/include/Eigen/src/SparseCore/SparseMatrixBase.h:47:30: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits<double>::type' {aka '__vector(2) double'} [-Wignored-attributes]
>::type PacketReturnType;
^~~~~~~~~~~~~~~~
from ranger.
I expected that the C++14 change causes problems here and there. @wangzitiner which R version is this?
@aschmidt-amplify here is a list where Makevars.win could be.
Generally, a workaround is to install a version <0.14.2 where we switched to C++14.
from ranger.
@mnwright I tried on both R4.2.2 and R3.6.9, both have the same error.
And it seems that I don't have Makevars on my linux, but I'm not sure if I searched the right way.
Here is the code:
10:22 zhaoqy@wanglab:~$ which Makevars
/usr/bin/which: no Makevars in (/mnt/date3/Project/zhaoqy/.local/bin:/mnt/date3/Project/zhaoqy/miniconda3/condabin:/opt/rh/devtoolset-8/root/usr/bin:/usr/lib64/qt-3.3/bin:/opt/gridview//pbs/dispatcher-sched/bin:/opt/gridview//pbs/dispatcher-sched/sbin:/opt/gridview//pbs/dispatcher/bin/lsf_cmd:/opt/gridview//pbs/dispatcher/bin:/opt/gridview//pbs/dispatcher/sbin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bioware/source/subread-1.6.2-Linux-x86_64/bin:/bioware/homer/bin:/bioware/GraphProt-1.1.3/bin:/bioware/circRNA:/bioware/bin:/bioware/hisat2-2.0.5:/bioware/sratoolkit.2.10.9-centos_linux64/bin:/bioware/source/zhaowq/CogentAP:/bioware/bin:/bioware/bin/SystemPipeR:/bioware/bin/SingleCell:/bioware/bin/ngsplot/bin:/usr/local/python3/bin/:/bioware/meme-5.3.0/bin/:/bioware/source/Bismark-0.22.3:/user/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/bin:/user/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin)
from ranger.
And also I tried to install "ranger" by conda, the install seems successful, but I still failed when install URD(a Trajectory analysis R package), and still the same kind of error.
1\ Install ranger through anaconda:
12:12 wangzt@wanglab:~$ conda install -c conda-forge r-ranger
Collecting package metadata (current_repodata.json): done
Solving environment: done
...
Downloading and Extracting Packages
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
2\ Install URD in R4.2.2:
source("https://raw.githubusercontent.com/farrellja/URD/master/URD-Install.R")
Installing required packages from Bioconductor (BiocManager).
Bioconductor version 3.16 (BiocManager 1.30.20), R 4.2.1 (2022-06-23)
Installing package(s) 'destiny'
还安装相依关系‘ranger’, ‘VIM’
- installing source package ‘ranger’ ...
** 成功将‘ranger’程序包解包并MD5和检查
** using staged installation
** libs
g++ -std=gnu++11 -I"/bioware/source/R-4.2.1/include" -DNDEBUG -DR_BUILD -I'/bioware/source/R-4.2.1/library/Rcpp/include' -I'/bioware/source/R-4.2.1/library/RcppEigen/include' -I/usr/local/include -fpic -g -O2 -c AAA_check_cpp11.cpp -o AAA_check_cpp11.o
AAA_check_cpp11.cpp:3:2: error: #error Error: ranger requires a C++14 compiler, e.g., gcc >= 5 or Clang >= 3.4. You probably have to update your C++ compiler.
#error Error: ranger requires a C++14 compiler, e.g., gcc >= 5 or Clang >= 3.4. You probably have to update your C++ compiler.
^~~~~
make: *** [/bioware/source/R-4.2.1/etc/Makeconf:177: AAA_check_cpp11.o] Error 1
ERROR: compilation failed for package ‘ranger’ - removing ‘/bioware/source/R-4.2.1/library/ranger’
ERROR: dependency ‘ranger’ is not available for package ‘VIM’ - removing ‘/bioware/source/R-4.2.1/library/VIM’
ERROR: dependency ‘VIM’ is not available for package ‘destiny’ - removing ‘/bioware/source/R-4.2.1/library/destiny’
Hope for your help, thank u!
from ranger.
The problem is related to R setting the default C++ standard to C++11 on Windows until R version 4.2.3 (for the 4.2.X releases) when the bug was fixed (https://cran.r-project.org/doc/manuals/r-release/NEWS.html). However, I had the same issue on R 4.1.2 even though the corresponding RTools does support C++ 14. My fix was to re-build the package from source myself and adding CXX_STD = CXX14
to src/Makevars.win
as advised here: https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Using-C_002b_002b-code
from ranger.
@rps13 Thank you so much. I use macOS system, does this problem still exists? (R setting the default C++ standard to C++11 on Windows until R version 4.2.3). And if it exists, will it be easier to directly update by R to 4.2.3?
from ranger.
@wangzitiner It was supposed to be a Windows-only issue so I don't think that would be the case for Mac; can you put the contents of your Makeconf
which you can find in /Library/Frameworks/R.framework/Resources/etc
up?
from ranger.
@rps13 Sorry, I don't know how to find this content. I use "which" to search "R.framework" and "Resources", both not found. where should I find my Makeconf?
from ranger.
@wangzitiner How did you install R? That is where the version from CRAN puts the files.
from ranger.
@rps13 I am still a tyro in this major. And I don't install R by myself, so please wait me a few minutes to check.
from ranger.
@mnwright @rps13
This is my Makeconf:
AR = ar
BLAS_LIBS = -L"$(R_HOME)/lib$(R_ARCH)" -lRblas
C_VISIBILITY = -fvisibility=hidden
CC = gcc -std=gnu11
CFLAGS = -g -O2 $(LTO)
CPICFLAGS = -fpic
CPPFLAGS = -I/usr/local/include
CXX = g++ -std=gnu++11
CXXFLAGS = -g -O2 $(LTO)
CXXPICFLAGS = -fpic
CXX11 = g++
CXX11FLAGS = -g -O2 $(LTO)
CXX11PICFLAGS = -fpic
CXX11STD = -std=gnu++11
CXX14 =
CXX14FLAGS = $(LTO)
CXX14PICFLAGS =
CXX14STD =
CXX17 =
CXX17FLAGS = $(LTO)
CXX17PICFLAGS =
CXX17STD =
CXX20 =
CXX20FLAGS = $(LTO)
Should I change the eighth line from "CXX = g++ -std=gnu++11" to "CXX_STD = CXX14"?
from ranger.
@wangzitiner You would only need to change gnu++11
to gnu++14
on line 8 but you should just copy line 8 into $HOME/.R/Makevars
and modify it there instead of messing with the Makeconf
from ranger.
I changed it and it warned me because this file is readonly, and I use :wq! to force it to change. Is this situation same as yours?
from ranger.
@wangzitiner you should just copy line 8 into $HOME/.R/Makevars
and modify it there instead of messing with the Makeconf
from ranger.
Actually I only found Makeconf, Makeovers still failed to be found.
from ranger.
You need to create Makevars
yourself e.g.: vi ~/.R/Makevars
and then put the modified line 8 in it: CXX = g++ -std=gnu++14
from ranger.
I just try to install URD again, it seems to achieve a further step like this, but the package "destiny" is still not available, which is so disgusting. And the "gcc -std=gnu11" doesn't change successfully.
Update all/some/none? [a/s/n]: n
Installing URD
Downloading GitHub repo farrellja/URD@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?
1: All
2: CRAN packages only
3: None
4: vctrs (0.6.0 -> 0.6.1 ) [CRAN]
5: RcppArmad... (0.11.4.0.1 -> 0.12.2.0.0) [CRAN]
6: igraph (1.4.1 -> 1.4.2 ) [CRAN]
7: tibble (3.2.0 -> 3.2.1 ) [CRAN]
8: graphlayouts (0.8.2 -> 0.8.4 ) [CRAN]
Enter one or more numbers, or an empty line to skip updates: 1
gcc -std=gnu11 -I"/bioware/source/R-4.2.1/include" -DNDEBUG -DUSING_R -I. -Icore -Iinclude -Ivendor -I/mnt/date3/Project/wangzt/anaconda3/include/libxml2 -I/mnt/date3/Project/wangzt/anaconda3/include -DNDEBUG -DNTIMER -DNPRINT -DINTERNAL_ARPACK -DPRPACK_IGRAPH_SUPPORT -DIGRAPH_THREAD_LOCAL=/**/ -I'/bioware/source/R-4.2.1/library/cpp11/include' -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c vendor/cs/cs_compress.c -o vendor/cs/cs_compress.o
gcc -std=gnu11 -I"/bioware/source/R-4.2.1/include" -DNDEBU
from ranger.
This is the result, it seems that "ranger" is ok? I am not sure now.
URD installed successfully!
You can load it by typing: library("URD")
Try "?URD" for starting tips.
Warning messages:
1: package(s) not installed when version(s) same as or greater than current; use
force = TRUE
to re-install: 'Biobase' 'S4Vectors' 'AnnotationDbi'
2: In i.p(...) : 安装程序包‘vctrs’时退出狀態的值不是0
3: In i.p(...) : 安装程序包‘RcppArmadillo’时退出狀態的值不是0
4: In i.p(...) : 安装程序包‘igraph’时退出狀態的值不是0
5: In i.p(...) : 安装程序包‘tibble’时退出狀態的值不是0
6: In i.p(...) : 安装程序包‘graphlayouts’时退出狀態的值不是0
from ranger.
Try loading ranger with library(ranger)
to make sure but the other warnings are saying that the packages didn't install correctly (vctrs, RcppArmadillo, etc.)
from ranger.
I created a Makevars yesterday, but still failed in installation . Only after I changed the Makeconf today then it succeeded. And library(ranger) is completely ok!!
library(ranger)
Thank you so much for your patience !
So kind of you!
from ranger.
It's a bit strange Makevars
didn't work as it's supposed to override Makeconf
from ranger.
If this fails for anyone else, please report here.
from ranger.
I am having the same problem in Debian linux, R 4.04
from ranger.
@olyerickson They are all working on the same machine?
To be clear: On an up-to-date system this should not happen and these workarounds should not be necessary.
from ranger.
By definition, RStudio Server is a shared, web-accessed service; in a given term we typically might have 60-90 students (plus researchers, et.al.) active on our cluster, most using R. On such a shared resource, updates e.g. to R and its dependencies happen more slowly (often during term breaks).
from ranger.
Please re-open if necessary. Anything we can improve to avoid such problems?
from ranger.
Hi! I think it might help to put information about this on the github readme for the package (or a link to this issue thread). There's a big gap between the technical prowess needed to use R vs to diagnose this issue, and folks don't always control whether they have the latest version. Thanks!
from ranger.
What exactly would you put in the readme?
I wouldn't link this issue. It might confuse people and e.g. what @olyerickson writes in their FAQ is wrong (ranger does not specify C++11 anywhere).
I think the major problem was the bug in R (fixed in R 4.2.3) that still specified C++11 for Windows (see https://cran.r-project.org/doc/manuals/r-release/NEWS.html).
from ranger.
I was thinking something like "ranger changed to the C++14 standard with version 0.15.0, if you are using R < 4.2.3 (Windows) or R < 4.1.0 (Mac and Linux) this may cause an error [link to slightly more detailed explanation]" (I'm not totally sure about the latter version, but I came to this issue from R 4.0.2 on an Ubuntu server that I do not have the ability to update).
But then I had the epiphany that it would be less noisy and more direct to put it in the error message (
ranger/src/AAA_check_cpp11.cpp
Line 3 in 5a04d93
In any case, I think you're within your rights to do neither, there is certainly a point when "you should just have updated R" is a good response. And one I can use to put pressure on the IT department :)
from ranger.
Thanks! I thought the same with the error message and putting the version requirements somewhere also makes sense. But (as you pointed out) what exactly are those? The R NEWS (linked above) says C++14 is supported since 3.4.0 but the default was changed with 4.1.0 and by accident for Windows only with 4.2.3. Does that mean that people with with R<4.1.0 (Windows: 4.2.3) need something like CXX = g++ -std=gnu++11
in their Makevars? If that is true, there are two options:
- Add this to the ranger Makevars.
- People have to add it to their own Makevars.
When the change was made, CRAN people said we shouldn't do 1). Writing R Extensions says
Different versions of R have used different default C++ standards, so for maximal portability a package should specify the standard it requires.
but also:
On the other hand, specifying C++11 when the code is valid under C++14 or C++17 reduces future portability.
If this is all correct, we could add a note on how to install ranger with older R versions. Or even add CXX_STD = CXX14
to the ranger Makevars, even though that is not recommended.
What we really need is to specify that we need at least C++14 but that is not possible I think.
from ranger.
That does sort of put you in a bind, although I understand why they'd say not to do # 1.
My perspective is that I arrived at "Error: ranger requires a C++14 compiler, e.g., gcc >= 5 or Clang >= 3.4. You probably have to update your C++ compiler." and then found that I had gcc 7.5, and just had no idea what to do for a week, until I eventually noticed the "C++11" on the console output. At which point I was still confused, hah.
So I guess I think for most users it's fine to ask THEM to do the fancy part (update their R version or modify their Makevars, the latter covering people like me who can't update the R version), and it would go a long way to give context/guidance in that same message. Like, presumably you made an informed decision on how to set up 0.15.0 and it seems like you should get to keep it that way and then also just add a lil note.
from ranger.
Related Issues (20)
- Increasing mtry crashes ranger fit HOT 3
- make fails => cannot compile C++ source on Mac HOT 2
- Error updating the package HOT 14
- warnings generated running 'Understanding random forests with randomForestExplainer' code HOT 1
- num.threads causing crashes inside caret recursive feature elimination wrapper HOT 1
- Results from importance_pvalues() differ despite setting seed HOT 1
- Decision Tree Build HOT 2
- Random forest prediction intervals using the out-of-bag predictions errors. HOT 2
- Is there a way to fit an isolation forest using ranger? HOT 1
- Node-wise impurity decrease HOT 2
- Extract "dependent.variable.name" from a ranger object HOT 6
- No Tree Plotting Function Provided by Package HOT 2
- Add C++14 specification (`std::make_unique` is only avaiable from C++14 onwards) HOT 2
- classProbs are not in line with the predicted label HOT 4
- Trees summary statistics: height, splits HOT 2
- Matrices without colnames. HOT 2
- A check on inbag size would be nice
- Feature Request: inclusion of the trivial random forest model HOT 2
- compilation failed for package 'ranger' HOT 2
- Clarify Gini index calculation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ranger.