python.cpp:3125:36: error: call of overloaded ‘Vector(<brace-enclosed initializer list>)’ is ambiguous return CharacterVector({id.str()});

I am trying to install "reticulate" and it fails with the below error, any help is appriciated.

trying URL ''
Content type 'application/x-gzip' length 1551312 bytes (1.5 MB)

downloaded 1.5 MB

  • installing source package ‘reticulate’ ...
    ** package ‘reticulate’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    g++ -std=gnu++11 -I"/data/apps/R-4.2.3/lib64/R/include" -DNDEBUG -I'/data/apps/R-4.2.3/lib64/R/library/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
    g++ -std=gnu++11 -I"/data/apps/R-4.2.3/lib64/R/include" -DNDEBUG -I'/data/apps/R-4.2.3/lib64/R/library/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c event_loop.cpp -o event_loop.o
    g++ -std=gnu++11 -I"/data/apps/R-4.2.3/lib64/R/include" -DNDEBUG -I'/data/apps/R-4.2.3/lib64/R/library/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c libpython.cpp -o libpython.o
    g++ -std=gnu++11 -I"/data/apps/R-4.2.3/lib64/R/include" -DNDEBUG -I'/data/apps/R-4.2.3/lib64/R/library/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c output.cpp -o output.o
    g++ -std=gnu++11 -I"/data/apps/R-4.2.3/lib64/R/include" -DNDEBUG -I'/data/apps/R-4.2.3/lib64/R/library/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c python.cpp -o python.o
    python.cpp: In function ‘SEXPREC* py_id(PyObjectRef)’:
    python.cpp:3125:36: error: call of overloaded ‘Vector()’ is ambiguous
    return CharacterVector({id.str()});
    python.cpp:3125:36: note: candidates are:
    In file included from /data/apps/R-4.2.3/lib64/R/library/Rcpp/include/Rcpp/Vector.h:52:0,
    from /data/apps/R-4.2.3/lib64/R/library/Rcpp/include/Rcpp.h:40,
    from python.cpp:7:
    /data/apps/R-4.2.3/lib64/R/library/Rcpp/include/Rcpp/vector/Vector.h:101:5: note: Rcpp::Vector<RTYPE, StoragePolicy>::Vector(const string&) [with int RTYPE = 16; StoragePolicy = Rcpp::PreserveStorage; std::string = std::basic_string]
    Vector( const std::string& st ){
    /data/apps/R-4.2.3/lib64/R/library/Rcpp/include/Rcpp/vector/Vector.h:63:5: note: Rcpp::Vector<RTYPE, StoragePolicy>::Vector(const Rcpp::Vector<RTYPE, StoragePolicy>&) [with int RTYPE = 16; StoragePolicy = Rcpp::PreserveStorage]
    Vector( const Vector& other){
    make: *** [python.o] Error 1
    ERROR: compilation failed for package ‘reticulate’
  • removing ‘/data/apps/R-4.2.3/lib64/R/library/reticulate’

The downloaded source packages are in
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("reticulate") :
installation of package ‘reticulate’ had non-zero exit status


1 Like

I have the same issue; one difference is that I am using R 3.6.0 but the compilation errors are the same.

The solution for me was to properly set the ~/.R/Makevars file. My system default g++ was too old to compile this code. RcppToML (and maybe most other other Rcpp packages?) will use the g++ set by the the CXX variable in the ~/.R/Makevars file (and not CXX11, CXX14, or CXX17, which I had set already).