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 'https://cloud.r-project.org/src/contrib/reticulate_1.28.tar.gz'
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
‘/tmp/RtmpelSIu7/downloaded_packages’
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

Thanks
Pavan

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).

I'm having a similar issue. If CXX11, CXX14, and CXX17 didn't work, what did you put in your Makevars for it to work?

Ah, neglected that important info -- just plain old CXX=/path/to/modern/g++

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.