Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation error in centos R #1292

Closed
MengyuanLyu opened this issue Oct 28, 2022 · 14 comments
Closed

installation error in centos R #1292

MengyuanLyu opened this issue Oct 28, 2022 · 14 comments
Labels
reprex Can't reproduce

Comments

@MengyuanLyu
Copy link

Hello,
I try to install Seurat package in R at centos. However, it indicates there are some errors in the Reticulate installation. Here is the detailed information:

python.cpp:3111:36 :error: call of overloaded 'Vector()' is ambiguous
return CharacterVector({id.str()});
Python.cpp.3111.36: note: candidates are:
In file included from /root/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp/Vector.h:52:0,
from /root/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp.h:40,
from python.cpp:7:
/root/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp/vector/Vector.h:102: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) {
^
/root/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp/vector/Vector.h:64: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 '/root/R/x86_64-pc-linux-gnu-library/4.1/reticulate'

Hope for your reply.
Thank you very much

@kevinushey
Copy link
Collaborator

What version of gcc are you using?

@jiemengzhang
Copy link

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)

@kevinushey
Copy link
Collaborator

Presumedly this is caused by us using C++11 features not supported by your compiler, but even gcc 4.8.5 should be okay here.

@t-kalinowski what do you think?

@kevinushey
Copy link
Collaborator

See also: #1301

@eddelbuettel
Copy link
Contributor

How about using devtoolset ? It is meant to be a band-aid of offering less-deprecated compiler to 'by-design' ancient and outdated CentOS/RHEL release that have trouble with current software.

@jiemengzhang
Copy link

jiemengzhang commented Dec 7, 2022 via email

@jiemengzhang
Copy link

How about using devtoolset ? It is meant to be a band-aid of offering less-deprecated compiler to 'by-design' ancient and outdated CentOS/RHEL release that have trouble with current software.

It did not work.

devtools::install("reticulate")
Error in package_file():
! reticulate is not a directory.
Run rlang::last_error() to see where the error occurred.
devtools::install_github("rstudio/reticulate")
Downloading GitHub repo rstudio/reticulate@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: RcppTOML (0.1.3 -> 0.1.7) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3
── R CMD build ────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/tmp/Rtmp1PTkHQ/remotes772cafefd60/rstudio-reticulate-a1d7f7f/DESCRIPTION’ ...
─ preparing ‘reticulate’:
✔ checking DESCRIPTION meta-information ...
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘reticulate_1.26-9000.tar.gz’

Installing package into ‘/home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)

  • installing source package ‘reticulate’ ...
    ** using staged installation
    ** libs
    g++ -std=gnu++11 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I'/home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
    g++ -std=gnu++11 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I'/home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c event_loop.cpp -o event_loop.o
    g++ -std=gnu++11 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I'/home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c libpython.cpp -o libpython.o
    g++ -std=gnu++11 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I'/home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -I/usr/local/include -fpic -g -O2 -c output.cpp -o output.o
    g++ -std=gnu++11 -I"/opt/R/4.1.3/lib/R/include" -DNDEBUG -I'/home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/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:3130:36: error: call of overloaded ‘Vector()’ is ambiguous
    return CharacterVector({id.str()});
    ^
    python.cpp:3130:36: note: candidates are:
    In file included from /home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp/Vector.h:52:0,
    from /home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp.h:40,
    from python.cpp:7:
    /home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp/vector/Vector.h:102: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 ){
    ^
    /home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp/vector/Vector.h:64: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 ‘/home/jiemeng.zhang/R/x86_64-pc-linux-gnu-library/4.1/reticulate’
    Warning message:
    In i.p(...) :
    installation of package ‘/tmp/Rtmp1PTkHQ/file772c641d382f/reticulate_1.26-9000.tar.gz’ had non-zero exit status

@jiemengzhang
Copy link

It did not work. How could I fix it?

@kevinushey
Copy link
Collaborator

It is 2022 and yet we still get burned for using features from a now 10 year old C++ standard. Sigh...

@eddelbuettel
Copy link
Contributor

Well AFAIK devtoolset works for other users bringing a less-dated toolchain to a very dated OS release. Besides saying "it did not work" @jiemengzhang did not convince me got the compiler switched. As I recall (when I had to rely on it) its use is a bit weird -- . somescript.sh in a session is needed.

@t-kalinowski
Copy link
Member

hmm, I tried to reproduce the error in docker (to see how hard the fix would be), but it looks like RcppTOML fails to install before I even get to a reticulate error.

Dockerfile:
FROM centos:centos7

# EPEL
RUN yum -y update
RUN yum -y install epel-release

RUN yum -y group install "Development tools"
RUN yum -y install sudo wget git tar python3-devel gcc glibc-devel curl
RUN yum-builddep -y python3
RUN yum-builddep -y R
RUN yum -y install R python3

RUN Rscript \
-e 'p <- unlist(strsplit(Sys.getenv("R_LIBS_SITE"), ":"))' \
-e 'lapply(p[!dir.exists(p)], dir.create, recursive = TRUE)'

RUN Rscript -e 'install.packages("remotes", repos = list(repos = c(CRAN = "https://cran.rstudio.com")))'

ADD . reticulate
WORKDIR reticulate
RUN Rscript -e 'remotes::install_local(dependencies = TRUE)'
Relevant Output:
* installing *source* package 'RcppTOML' ...
** package 'RcppTOML' successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I"/usr/local/lib/R/site-library/Rcpp/include" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c RcppExports.cpp -o RcppExports.o
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I"/usr/local/lib/R/site-library/Rcpp/include" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c parse.cpp -o parse.o
In file included from parse.cpp:28:0:
../inst/include/toml.hpp: In static member function 'static std::string includize::toml_spec<char>::unescape_filename(const string&)':
../inst/include/toml.hpp:29:66: error: no matching function for call to 'regex_replace(const string&, std::regex, const char [2])'
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
../inst/include/toml.hpp:29:66: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from ../inst/include/includize.hpp:7,
                 from ../inst/include/toml.hpp:4,
                 from parse.cpp:28:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note:   template argument deduction/substitution failed:
In file included from parse.cpp:28:0:
../inst/include/toml.hpp:29:66: note:   deduced conflicting types for parameter '_Bi_iter' ('std::basic_regex<char>' and 'const char*')
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from ../inst/include/includize.hpp:7,
                 from ../inst/include/toml.hpp:4,
                 from parse.cpp:28:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(const basic_string<_Ch_type>& __s,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note:   template argument deduction/substitution failed:
In file included from parse.cpp:28:0:
../inst/include/toml.hpp:29:66: note:   mismatched types 'const std::basic_string<_Ch_type>' and 'const char [2]'
         return std::regex_replace(str, std::regex("\\\\\""), "\"");
                                                                  ^
../inst/include/toml.hpp:30:5: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
make: *** [parse.o] Error 1
ERROR: compilation failed for package 'RcppTOML'
* removing '/usr/local/lib/R/site-library/RcppTOML'
...
Running `R CMD build`...
* checking for file '/tmp/RtmpwtsMZc/file1349e3939/reticulate/DESCRIPTION' ... OK
* preparing 'reticulate':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'reticulate_1.26-9000.tar.gz'
Installing package into '/usr/local/lib/R/site-library'
(as 'lib' is unspecified)
ERROR: dependency 'RcppTOML' is not available for package 'reticulate'
* removing '/usr/local/lib/R/site-library/reticulate'
Warning messages:
1: In i.p(...) :
  installation of package 'RcppTOML' had non-zero exit status
2: In i.p(...) :
  installation of package '/tmp/RtmpwtsMZc/file110a0df45/reticulate_1.26-9000.tar.gz' had non-zero exit status

@eddelbuettel
Copy link
Contributor

eddelbuettel commented Dec 15, 2022

On a call right now so cannot dig but RcppTOML is reasonably 'old' and 'stale' (in the sense that I need to switch the C++ library I use to another one). It has built the same way for years and should not require anything more than C++11.

Edit: Glancing at the Dockerfile you are not using devtools, right? That would leave you on an ancient toolchain.

Edit 2: It clearly shows gcc 4.8.2. That has been 'too old' for a maybe up to a decade. gcc/g++ 4.9.2 (as was used on Windows cycles ago) is the known minimum. These days gcc/g++ 8.* is AFAIK a more realistic minimum.

@t-kalinowski
Copy link
Member

t-kalinowski commented Dec 15, 2022

@jiemengzhang or @MengyuanLyu How did you install reticulate and RcppTOML previously?
If you could modify the docker file in my previous comment to help me recreate the error you're seeing that would be immensely helpful.

@WeberKang
Copy link

I solved the problem @MengyuanLyu
First use scl to manage devtoolset

# 1. Install a package with repository for your system:
# On CentOS, install package centos-release-scl available in CentOS repository:
$ sudo yum install centos-release-scl

# On RHEL, enable RHSCL repository for you system:
$ sudo yum-config-manager --enable rhel-server-rhscl-9-rpms

# 2. Install the collection:
$ sudo yum install devtoolset-9

# 3. Start using software collections:
$ scl enable devtoolset-9 bash

Then just install it in your R environment
install.packages("reticulate")
Since we are only activating devtoolset-9 in the current bash environment, be sure to run it under the same bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex Can't reproduce
Projects
None yet
Development

No branches or pull requests

6 participants