2017-07-16 101 views
0

我想在Red Hat 6.安裝rpy2我已經升級至R 3.3.3以下這些指令:https://oguya.ch/posts/2017-03-18-building-R-on-rhel-6/錯誤RHEL6上安裝ryp2有R 3.3.3

當我做rpy2安裝失敗與以下內容:

$ sudo /usr/local/bin/pip2.7 install rpy2 
Collecting rpy2 
    Using cached rpy2-2.8.6.tar.gz 
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/site-packages (from rpy2) 
Requirement already satisfied (use --upgrade to upgrade): singledispatch in /usr/local/lib/python2.7/site-packages (from rpy2) 
Installing collected packages: rpy2 
    Running setup.py install for rpy2 ... error 
    Complete output from command /usr/local/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-eFwk3n/rpy2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-w5v7yg-record/install-record.txt --single-version-externally-managed --compile: 
    R version 3.3.3 (2017-03-06) -- "Another Canoe" 
    /usr/local/lib64/R/bin/R CMD config --ldflags 
    /usr/local/lib64/R/bin/R CMD config --cppflags 

     Compilation parameters for rpy2's C components: 
      include_dirs = ['/usr/local/lib64/R/include'] 
      library_dirs = ['/usr/local/lib64/R/lib'] 
      libraries  = ['Rblas', 'gfortran', 'm', 'readline', 'pcre', 'lzma', 'bz2', 'z', 'rt', 'dl', 'm'] 
      extra_link_args = ['-Wl,--export-dynamic', '-fopenmp', '-Wl,--whole-archive', '/usr/local/lib64/R/lib/libR.a', '-Wl,--no-whole-archive'] 

    running install 
    running build 
    running build_py 
    creating build 
    creating build/lib.linux-x86_64-2.7 
    creating build/lib.linux-x86_64-2.7/rpy2 
    copying ./rpy/__init__.py -> build/lib.linux-x86_64-2.7/rpy2 
    copying ./rpy/tests_rpy_classic.py -> build/lib.linux-x86_64-2.7/rpy2 
    copying ./rpy/rpy_classic.py -> build/lib.linux-x86_64-2.7/rpy2 
    copying ./rpy/tests.py -> build/lib.linux-x86_64-2.7/rpy2 
    creating build/lib.linux-x86_64-2.7/rpy2/rlike 
    copying ./rpy/rlike/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/rlike 
    copying ./rpy/rlike/indexing.py -> build/lib.linux-x86_64-2.7/rpy2/rlike 
    copying ./rpy/rlike/container.py -> build/lib.linux-x86_64-2.7/rpy2/rlike 
    copying ./rpy/rlike/functional.py -> build/lib.linux-x86_64-2.7/rpy2/rlike 
    creating build/lib.linux-x86_64-2.7/rpy2/rlike/tests 
    copying ./rpy/rlike/tests/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/rlike/tests 
    copying ./rpy/rlike/tests/test_indexing.py -> build/lib.linux-x86_64-2.7/rpy2/rlike/tests 
    copying ./rpy/rlike/tests/test_functional.py -> build/lib.linux-x86_64-2.7/rpy2/rlike/tests 
    copying ./rpy/rlike/tests/test_container.py -> build/lib.linux-x86_64-2.7/rpy2/rlike/tests 
    creating build/lib.linux-x86_64-2.7/rpy2/rinterface 
    copying ./rpy/rinterface/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface 
    creating build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_SexpSymbol.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_SexpVector.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_Sexp.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_SexpExtPtr.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_SexpVectorNumeric.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_SexpEnvironment.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_EmbeddedR.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_SexpClosure.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    copying ./rpy/rinterface/tests/test_Device.py -> build/lib.linux-x86_64-2.7/rpy2/rinterface/tests 
    creating build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/functions.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/vectors.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/environments.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/language.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/packages_utils.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/packages.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/pandas2ri.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/numpy2ri.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/conversion.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/methods.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/help.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/robject.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    copying ./rpy/robjects/constants.py -> build/lib.linux-x86_64-2.7/rpy2/robjects 
    creating build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testMethods.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testPandasConversions.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testRObject.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testFunction.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testNumpyConversions.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testArray.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testDataFrame.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testEnvironment.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testVector.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testPackages.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testHelp.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testLanguage.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testRobjects.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    copying ./rpy/robjects/tests/testFormula.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/tests 
    creating build/lib.linux-x86_64-2.7/rpy2/robjects/lib 
    copying ./rpy/robjects/lib/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib 
    copying ./rpy/robjects/lib/tidyr.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib 
    copying ./rpy/robjects/lib/grid.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib 
    copying ./rpy/robjects/lib/grdevices.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib 
    copying ./rpy/robjects/lib/dplyr.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib 
    copying ./rpy/robjects/lib/ggplot2.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib 
    creating build/lib.linux-x86_64-2.7/rpy2/robjects/lib/tests 
    copying ./rpy/robjects/lib/tests/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib/tests 
    copying ./rpy/robjects/lib/tests/test_ggplot2.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib/tests 
    copying ./rpy/robjects/lib/tests/test_grdevices.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib/tests 
    copying ./rpy/robjects/lib/tests/test_dplyr.py -> build/lib.linux-x86_64-2.7/rpy2/robjects/lib/tests 
    creating build/lib.linux-x86_64-2.7/rpy2/interactive 
    copying ./rpy/interactive/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/interactive 
    copying ./rpy/interactive/packages.py -> build/lib.linux-x86_64-2.7/rpy2/interactive 
    copying ./rpy/interactive/process_revents.py -> build/lib.linux-x86_64-2.7/rpy2/interactive 
    creating build/lib.linux-x86_64-2.7/rpy2/interactive/tests 
    copying ./rpy/interactive/tests/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/interactive/tests 
    creating build/lib.linux-x86_64-2.7/rpy2/ipython 
    copying ./rpy/ipython/html.py -> build/lib.linux-x86_64-2.7/rpy2/ipython 
    copying ./rpy/ipython/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/ipython 
    copying ./rpy/ipython/ggplot.py -> build/lib.linux-x86_64-2.7/rpy2/ipython 
    copying ./rpy/ipython/rmagic.py -> build/lib.linux-x86_64-2.7/rpy2/ipython 
    creating build/lib.linux-x86_64-2.7/rpy2/ipython/tests 
    copying ./rpy/ipython/tests/__init__.py -> build/lib.linux-x86_64-2.7/rpy2/ipython/tests 
    copying ./rpy/ipython/tests/test_rmagic.py -> build/lib.linux-x86_64-2.7/rpy2/ipython/tests 
    running build_clib 
    building 'r_utils' library 
    creating build/temp.linux-x86_64-2.7 
    creating build/temp.linux-x86_64-2.7/rpy 
    creating build/temp.linux-x86_64-2.7/rpy/rinterface 
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./rpy/rinterface -I/usr/local/lib64/R/include -c ./rpy/rinterface/r_utils.c -o build/temp.linux-x86_64-2.7/./rpy/rinterface/r_utils.o 
    In file included from /usr/local/lib64/R/include/Rdefines.h:36, 
        from ./rpy/rinterface/r_utils.c:23: 
    /usr/local/lib64/R/include/R_ext/Memory.h:51: warning: function declaration isn’t a prototype 
    In file included from /usr/local/lib64/R/include/Rdefines.h:40, 
        from ./rpy/rinterface/r_utils.c:23: 
    /usr/local/lib64/R/include/Rinternals.h:886: warning: function declaration isn’t a prototype 
    ar rc build/temp.linux-x86_64-2.7/libr_utils.a build/temp.linux-x86_64-2.7/./rpy/rinterface/r_utils.o 
    running build_ext 
    R version 3.3.3 (2017-03-06) -- "Another Canoe" 
    building 'rpy2.rinterface._rinterface' extension 
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/usr/local/lib64/R/include -I/usr/local/include/python2.7 -c ./rpy/rinterface/_rinterface.c -o build/temp.linux-x86_64-2.7/./rpy/rinterface/_rinterface.o 
    In file included from /usr/local/include/python2.7/Python.h:8, 
        from ./rpy/rinterface/_rinterface.c:49: 
    /usr/local/include/python2.7/pyconfig.h:1188:1: warning: "_POSIX_C_SOURCE" redefined 
    In file included from /usr/include/signal.h:29, 
        from ./rpy/rinterface/_rinterface.c:45: 
    /usr/include/features.h:213:1: warning: this is the location of the previous definition 
    In file included from /usr/local/lib64/R/include/R.h:80, 
        from ./rpy/rinterface/_rinterface.h:8, 
        from ./rpy/rinterface/_rinterface.c:52: 
    /usr/local/lib64/R/include/R_ext/Memory.h:51: warning: function declaration isn’t a prototype 
    In file included from ./rpy/rinterface/_rinterface.h:9, 
        from ./rpy/rinterface/_rinterface.c:52: 
    /usr/local/lib64/R/include/Rinternals.h:886: warning: function declaration isn’t a prototype 
    In file included from ./rpy/rinterface/_rinterface.c:64: 
    /usr/local/lib64/R/include/Rinterface.h:149: warning: function declaration isn’t a prototype 
    In file included from ./rpy/rinterface/_rinterface.c:73: 
    /usr/local/lib64/R/include/R_ext/Rdynload.h:36: warning: function declaration isn’t a prototype 
    In file included from ./rpy/rinterface/_rinterface.c:116: 
    ./rpy/rinterface/embeddedr.c: In function ‘SexpObject_clear’: 
    ./rpy/rinterface/embeddedr.c:48: warning: unused variable ‘res’ 
    In file included from ./rpy/rinterface/_rinterface.c:119: 
    ./rpy/rinterface/sexp.c: In function ‘Sexp_init’: 
    ./rpy/rinterface/sexp.c:742: warning: unused variable ‘copy’ 
    ./rpy/rinterface/_rinterface.c: At top level: 
    ./rpy/rinterface/_rinterface.h:203: warning: ‘PyRinterface_IsInitialized’ declared ‘static’ but never defined 
    ./rpy/rinterface/_rinterface.h:204: warning: ‘PyRinterface_FindFun’ declared ‘static’ but never defined 
    ./rpy/rinterface/_rinterface.h:205: warning: ‘embeddedR_isInitialized’ defined but not used 
    ./rpy/rinterface/sequence.c:2173: warning: ‘ComplexVectorSexp_AsSexp’ defined but not used 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowFiles’: 
    ./rpy/rinterface/_rinterface.c:831: warning: ‘gstate’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ResetConsole’: 
    ./rpy/rinterface/_rinterface.c:677: warning: ‘gstate’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_FlushConsole’: 
    ./rpy/rinterface/_rinterface.c:643: warning: ‘gstate’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ChooseFile’: 
    ./rpy/rinterface/_rinterface.c:727: warning: ‘gstate’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ReadConsole’: 
    ./rpy/rinterface/_rinterface.c:498: warning: ‘gstate’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_WriteConsoleEx’: 
    ./rpy/rinterface/_rinterface.c:339: warning: ‘consolecallback’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c:354: warning: ‘gstate’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_ShowMessage’: 
    ./rpy/rinterface/_rinterface.c:429: warning: ‘gstate’ may be used uninitialized in this function 
    ./rpy/rinterface/_rinterface.c: In function ‘EmbeddedR_CleanUp’: 
    ./rpy/rinterface/_rinterface.c:979: warning: ‘gstate’ may be used uninitialized in this function 
    gcc -pthread -shared build/temp.linux-x86_64-2.7/./rpy/rinterface/_rinterface.o -L/usr/local/lib64/R/lib -Lbuild/temp.linux-x86_64-2.7 -Wl,-R/usr/local/lib64/R/lib -lRblas -lgfortran -lm -lreadline -lpcre -llzma -lbz2 -lz -lrt -ldl -lm -lr_utils -o build/lib.linux-x86_64-2.7/rpy2/rinterface/_rinterface.so -Wl,--export-dynamic -fopenmp -Wl,--whole-archive /usr/local/lib64/R/lib/libR.a -Wl,--no-whole-archive 
    /usr/bin/ld: /usr/local/lib64/R/lib/libR.a(CommandLineArgs.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC 
    /usr/local/lib64/R/lib/libR.a(CommandLineArgs.o): could not read symbols: Bad value 
    collect2: ld returned 1 exit status 
    error: command 'gcc' failed with exit status 1 

    ---------------------------------------- 
Command "/usr/local/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-eFwk3n/rpy2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-w5v7yg-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-eFwk3n/rpy2/ 

任何人都知道問題是什麼,以及如何在這裏安裝rpy2?

也試過建設rpy2從源和失敗:

gcc -pthread -shared build/temp.linux-x86_64-2.7/./rpy/rinterface/_rinterface.o -L/usr/local/lib64/R/lib -Lbuild/temp.linux-x86_64-2.7 -Wl,-R/usr/local/lib64/R/lib -lRblas -lgfortran -lm -lreadline -lpcre -llzma -lbz2 -lz -lrt -ldl -lm -lr_utils -o build/lib.linux-x86_64-2.7/rpy2/rinterface/_rinterface.so -Wl,--export-dynamic -fopenmp -Wl,--whole-archive /usr/local/lib64/R/lib/libR.a -Wl,--no-whole-archive 

/usr/bin/ld: cannot find -lr_utils 

我找啊找,但沒有找到一個地方,我可以得到libr_utils。

回答

-1

正在運行pip install rpy2將從源代碼構建它。

堅持pippython setup.py install,如文件中所示。構建它時有幾個連接的部分,只發出一個gcc命令很可能會導致關於缺少庫的錯誤(如您所見)。

我不確定你看到的錯誤(可能是從陳舊的C編譯器到R或其他R庫的不兼容構建)。您在「企業」版本中使用的是相當老的系統。可能會有更多的企業支持渠道的答案或知識。

+0

如果從pip安裝工作,我不需要尋找其他方法。最後一個錯誤(缺少的lib)來自運行'python setup.py install'。我確實發現了這個問題 - 我的安裝epel-release被搞砸了。我重新安裝了那個,然後我能夠從回購站安裝R,然後用pip安裝rpy2。但是現在,當我嘗試使用它時,出現此錯誤:'ImportError:'沒有名爲rpy2.robjects''的模塊。所以我必須深入研究,看看發生了什麼。 –