4

I have the latest Anaconda Python distribution installed on Windows 8 and I am attempting to install the rpy2 package. I initially ran into several issues that I was able to circumvent but I'm now stuck on one particular error that I'm pasting below.

The command

pip install rpy2

exits with the following error message:

In file included from .\rpy\rinterface\_rinterface.c:58:0:

.\rpy\rinterface\_rinterface.h:8:15: fatal error: R.h: No such file or
directory

compilation terminated.

error: command 'gcc' failed with exit status 1

Any suggestions? The path to R.h is included on my environment.

Everaldo Aguiar
  • 4,016
  • 7
  • 26
  • 31

1 Answers1

5

Dr. Gohlke's binary is probably the easiest solution. But you need to change the Python installation path in your registry for this method to work. The relevant key is in HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath. Change it so that the anaconda Python is the default python installation. You can always change it back if you want.

CT Zhu
  • 52,648
  • 17
  • 120
  • 133
  • Well, this actually worked! I still can't seem to figure out what was causing the error earlier, but I guess that's besides the point now. Thanks :) – Everaldo Aguiar Jun 10 '14 at 02:43
  • It is also way hard to install `rpy2` on a `win` machine. That's why we all appreciate Dr. Gohlke's binaries. :) – CT Zhu Jun 10 '14 at 02:55
  • The default value is `Python 2.7`, should I change it to the absolute value of anaconda python? – B.Mr.W. Aug 28 '14 at 20:15
  • Hi @CTZhu I am stuck with a simular error on Linux `./rpy/rinterface/_rinterface.c:86:31: fatal error: readline/readline.h: No such file or directory compilation terminated. error: command 'gcc' failed with exit status 1` Any suggestions? – Shravan Dec 04 '14 at 14:32