问题
On mac 10.12.6, pip install rpy2
is giving me "Failed building wheel for rpy2"
I tried the this. Any ideas what to look at next?
Here is the error log:
----------------------------------------
Failed building wheel for rpy2
Running setup.py clean for rpy2
Failed to build rpy2
Installing collected packages: rpy2
Running setup.py install for rpy2 ... error
Complete output from command /Users/me/Applications/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/c2/tn3m3j415fq7hhh4zwwqrphw0000gn/T/pip-build-v9hm43qh/rpy2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/c2/tn3m3j415fq7hhh4zwwqrphw0000gn/T/pip-1onyudah-record/install-record.txt --single-version-externally-managed --compile:
R version 3.4.1 (2017-06-30) -- "Single Candle"
/usr/local/Cellar/r/3.4.1_1/lib/R/bin/R CMD config --ldflags
/usr/local/Cellar/r/3.4.1_1/lib/R/bin/R CMD config --cppflags
Compilation parameters for rpy2's C components:
include_dirs = ['/usr/local/Cellar/r/3.4.1_1/lib/R/include']
library_dirs = ['/usr/local/opt/gettext/lib', '/usr/local/opt/readline/lib', '/usr/local/lib', '/usr/local/opt/gettext/lib', '/usr/local/opt/readline/lib', '/usr/local/lib', '/usr/local/Cellar/r/3.4.1_1/lib/R/lib']
libraries = ['R', 'pcre', 'lzma', 'bz2', 'z', 'icucore', 'm', 'iconv']
extra_link_args = []
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/rpy2
copying ./rpy/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2
copying ./rpy/rpy_classic.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2
copying ./rpy/situation.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2
copying ./rpy/tests.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2
copying ./rpy/tests_rpy_classic.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike
copying ./rpy/rlike/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike
copying ./rpy/rlike/container.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike
copying ./rpy/rlike/functional.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike
copying ./rpy/rlike/indexing.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike/tests
copying ./rpy/rlike/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike/tests
copying ./rpy/rlike/tests/test_container.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike/tests
copying ./rpy/rlike/tests/test_functional.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike/tests
copying ./rpy/rlike/tests/test_indexing.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rlike/tests
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface
copying ./rpy/rinterface/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_Device.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_EmbeddedR.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_Sexp.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpClosure.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpEnvironment.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpExtPtr.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpSymbol.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpVector.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
copying ./rpy/rinterface/tests/test_SexpVectorNumeric.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/rinterface/tests
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/constants.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/conversion.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/environments.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/functions.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/help.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/language.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/methods.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/numpy2ri.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/packages.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/packages_utils.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/pandas2ri.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/robject.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
copying ./rpy/robjects/vectors.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testArray.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testDataFrame.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testEnvironment.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testFormula.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testFunction.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testHelp.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testLanguage.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testMethods.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testNumpyConversions.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testPackages.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testPandasConversions.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testRObject.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testRobjects.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
copying ./rpy/robjects/tests/testVector.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/tests
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/dbplyr.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/dplyr.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/ggplot2.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/grdevices.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/grid.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/test_dplyr.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
copying ./rpy/robjects/lib/tidyr.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/test_dplyr.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/test_ggplot2.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib/tests
copying ./rpy/robjects/lib/tests/test_grdevices.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/robjects/lib/tests
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/interactive
copying ./rpy/interactive/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/interactive
copying ./rpy/interactive/packages.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/interactive
copying ./rpy/interactive/process_revents.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/interactive
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/interactive/tests
copying ./rpy/interactive/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/interactive/tests
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython
copying ./rpy/ipython/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython
copying ./rpy/ipython/ggplot.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython
copying ./rpy/ipython/html.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython
copying ./rpy/ipython/rmagic.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython
creating build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython/tests
copying ./rpy/ipython/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython/tests
copying ./rpy/ipython/tests/test_rmagic.py -> build/lib.macosx-10.9-x86_64-3.6/rpy2/ipython/tests
running build_clib
building 'r_utils' library
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/rpy
creating build/temp.macosx-10.9-x86_64-3.6/rpy/rinterface
clang -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -I./rpy/rinterface -I/usr/local/Cellar/r/3.4.1_1/lib/R/include -c ./rpy/rinterface/r_utils.c -o build/temp.macosx-10.9-x86_64-3.6/./rpy/rinterface/r_utils.o
In file included from ./rpy/rinterface/r_utils.c:24:
In file included from /usr/local/Cellar/r/3.4.1_1/lib/R/include/Rdefines.h:36:
/usr/local/Cellar/r/3.4.1_1/lib/R/include/R_ext/Memory.h:48:17: warning: this function declaration is not a prototype [-Wstrict-prototypes]
int R_gc_running();
^
void
In file included from ./rpy/rinterface/r_utils.c:24:
In file included from /usr/local/Cellar/r/3.4.1_1/lib/R/include/Rdefines.h:40:
In file included from /usr/local/Cellar/r/3.4.1_1/lib/R/include/Rinternals.h:51:
/usr/local/Cellar/r/3.4.1_1/lib/R/include/R_ext/Rdynload.h:38:26: warning: this function declaration is not a prototype [-Wstrict-prototypes]
typedef void * (*DL_FUNC)();
^
void
In file included from ./rpy/rinterface/r_utils.c:24:
In file included from /usr/local/Cellar/r/3.4.1_1/lib/R/include/Rdefines.h:40:
/usr/local/Cellar/r/3.4.1_1/lib/R/include/Rinternals.h:919:26: warning: this function declaration is not a prototype [-Wstrict-prototypes]
const char *R_curErrorBuf();
^
void
3 warnings generated.
x86_64-apple-darwin13.4.0-ar rc build/temp.macosx-10.9-x86_64-3.6/libr_utils.a build/temp.macosx-10.9-x86_64-3.6/./rpy/rinterface/r_utils.o
unable to execute 'x86_64-apple-darwin13.4.0-ar': No such file or directory
error: command 'x86_64-apple-darwin13.4.0-ar' failed with exit status 1
----------------------------------------
Command "/Users/me/Applications/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/c2/tn3m3j415fq7hhh4zwwqrphw0000gn/T/pip-build-v9hm43qh/rpy2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/c2/tn3m3j415fq7hhh4zwwqrphw0000gn/T/pip-1onyudah-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/c2/tn3m3j415fq7hhh4zwwqrphw0000gn/T/pip-build-v9hm43qh/rpy2/
回答1:
The start of an answer, not yet working:
A/the rpy2 developer pointed me to this.
I followed the instructions here (for R >= 3.4.0) resulting in a new directories clang4
and gfortran
in /usr/local
. I also set up the ~/.R/Makevars
file as suggested. (There was no ~/.R
dir on my system previously). Doing these things had no evident effect.
I'm guessing I'm missing something basic. Should I be re-installing R? Exporting some environment variables?
来源:https://stackoverflow.com/questions/46873545/unable-to-install-rpy2