When I run 'sudo pip install rpy2' I get the a lot of compilation errors.
Here is the full dump of all the errors and here is an example except:
Compilation parameters for rpy2's C components: include_dirs = ['/usr/share/R/include'] library_dirs = ['/usr/lib/R/lib'] libraries = ['R', 'pcre', 'lzma', 'bz2', 'z', 'rt', 'dl', 'm'] extra_link_args = ['-Wl,--export-dynamic', '-fopenmp'] R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" building 'rpy2.rinterface._rinterface' extension x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -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/share/R/include -I/usr/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/share/R/include/R.h:46:0, from ./rpy/rinterface/_rinterface.h:8, from ./rpy/rinterface/_rinterface.c:58: /usr/share/R/include/R_ext/Memory.h:40:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] int R_gc_running(); ^ In file included from ./rpy/rinterface/_rinterface.h:9:0, from ./rpy/rinterface/_rinterface.c:58: /usr/share/R/include/Rinternals.h:831:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] const char *R_curErrorBuf(); ^ In file included from ./rpy/rinterface/_rinterface.c:70:0: /usr/share/R/include/Rinterface.h:129:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] extern void (*ptr_R_ProcessEvents)(); ^ In file included from ./rpy/rinterface/_rinterface.c:79:0: /usr/share/R/include/R_ext/Rdynload.h:32:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] typedef void * (*DL_FUNC)(); ^ ./rpy/rinterface/_rinterface.c:86:31: fatal error: readline/readline.h: No such file or directory #include <readline/readline.h> ^ compilation terminated.
Some background. Previously botched the installation of ipython notebook dev version and have reverted back to the pip repository version. Not sure if that plays a role. Was able to get R magic working a little before that.
I had made sure to run 'apt-get updates', 'pip uninstall rpy2', 'apt-get purge python-rpy2 && apt-get remove python-rpy2' before attempt to re-install. To check if there was any residual files, I ran 'import rpy2' in ipython and that resulted in an module not found error (good, nothing was lingering).
Not sure where to begin troubleshooting. Advice is appreciated.
Edit: Nov 26, 2014
It worked after installing the following dependencies:
- apt-get install libreadline-dev
- apt-get install r-base r-base-dev python-dev python-setuptools