Go to TogaWare.com Home Page.
GNU/Linux Desktop Survival Guide
by Graham Williams
Google

Installing RSPython




  $ wget http://www.omegahat.org/RSPython/RSPython_0.5-1.tar.gz

Then install RSPython in R:



  # R CMD INSTALL --clean RSPython_0.5-1.tar.gz

This command, executed as the root user has then installed the required files into /usr/lib/R/library/RSPython. To communicate where the files are installed to Python we need to set up three environment variables (a Debian package would probably set this up so that these extra environment variables are not required), and then run Python and try out some RSPython calls:



  $ export R_HOME=/usr/lib/R
  $ export PYTHONPATH=${R_HOME}/library/RSPython/Python
  $ export PYTHONPATH=${PYTHONPATH}:${R_HOME}/library/RSPython/libs
  $ export LD_LIBRARY_PATH=${R_HOME}/bin
  $ python
  Python 2.2.1 (#2, Sep 13 2002, 23:25:07) 
  [GCC 2.95.4 20011002 (Debian prerelease)] on linux2
  Type "help", "copyright", "credits" or "license" for more information. 
  >>> import RS
  Initialized R-Python interface package. 
  >>> RS.call("rnorm", 10)
  [-0.65567988872831473, 0.67905969371540564, -1.1444361954473865, 
   0.81452303045337249, 0.72703311800839554, 0.86401079894005484, 
   -2.0267500136837922, 1.3879521193129922, -0.59819064121768595, 
   1.1045450495203162]
  >>> RS.call("plot", [1,2,3,4])
  >>> RS.call("plot", RS.call("rnorm",10))
  >>> ^D

If you get:



  $ python
  >>> import RS
  Traceback (most recent call last):
    File "<stdin>", line 1, in ? 
    File "/usr/lib/R/library/RSPython/Python/RS.py", line 1, in ? 
      import RSInternal
  ImportError: /usr/lib/atlas/libblas.so.2: undefined symbol: e_wsfe
  >>>

Then be sure that you don't have atlas2-base installed:



  $ wajig remove atlas2-base


Copyright © 1995-2014 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.