Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've encountered a somewhat different but related installation problem and finally found a solution at <a href="http://www.mail-archive.com/rpy-list@lists.sourceforge.net/msg02817.html" rel="nofollow">http://www.mail-archive.com/rpy-list@lists.sourceforge.net/msg02817.html</a></p> <p>After I installed rpy2 2.0.8 via rpy2-2.0.8.win32-py2.6.msi (windows 7 (64bit), python 2.6, R 2.14 (both 32bit and 64bit, via RAndFriendsSetup2140V3.2-1-1.exe)), and tried to import rpy2 within python console, I got the exception:</p> <p><em>Unable to locate R.dll</em></p> <p>Adding the following lines to rinterface/__init__.py made it work:</p> <pre><code>if os.path.exists(os.path.join(R_HOME, 'lib')): ## ADDED ## os.environ['PATH'] += ';' + os.path.join(R_HOME, 'bin') os.environ['PATH'] += ';' + os.path.join(R_HOME, 'modules') os.environ['PATH'] += ';' + os.path.join(R_HOME, 'lib') else: ## ADDED ## os.environ['PATH'] += ';' + os.path.join(R_HOME, 'bin', 'i386') ## ADDED ## os.environ['PATH'] += ';' + os.path.join(R_HOME, 'modules', 'i386') ## ADDED ## os.environ['PATH'] += ';' + os.path.join(R_HOME, 'library') ## ADDED ## # Load the R dll using the explicit path # First try the bin dir: Rlib = os.path.join(R_HOME, 'bin', 'R.dll') # Try bin/i386 subdirectory seen in R 2.12.0 ## ADDED ## if not os.path.exists(Rlib): ## ADDED ## Rlib = os.path.join(R_HOME, 'bin', 'i386', 'R.dll') ## ADDED ## # Then the lib dir: if not os.path.exists(Rlib): Rlib = os.path.join(R_HOME, 'lib', 'R.dll') # Otherwise fail out! if not os.path.exists(Rlib): raise RuntimeError("Unable to locate R.dll within %s" % R_HOME) </code></pre> <p>It turns out that the R.dll is moved but the __init__.py is not updated accordingly. So simply editing the __init__.py file will get things right.</p> <p>Then I tried to replicate Taj G's situation, and I did it. After adding "your_R_installation_dir\bin\i386" into the windows environment variable PATH, the old error disappeared but new one came:</p> <p><em>ValueError: Invalid substring in string</em></p> <p>It seems that some additional pieces need to be installed and a C/C++ compiler needs to be correctly configured. I gave up here. Using easy_install to build rpy2 from source seems really tricky on windows and not officially support at present.</p> <p>Although rpy2 2.0.8 is not a full-fledged version compared with 2.2.4, it is the latest version with standard windows installer on sourceforge. For now, it is the easy choice.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload