[R] calling R from python (fwd)

Agustin Lobo alobo at ija.csic.es
Mon Dec 23 11:55:03 CET 2002


A question for a (experienced) user of the RPython package on
linux.

I'm trying to call R from python on a linux (Suse 7.3) box.

After installing  R CMD INSTALL -c RSPython_0.5-2.tar.gz

I start python and do:

>>> import sys
>>> sys.path.append('/usr/local/lib/R/library/RSPython')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/Python')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/libs')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/man')
>>> sys.path.append('/usr/local/lib/R/library/R/RSPython')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/R/RSPython')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/R')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/include')
>>> sys.path.append('/usr/local/lib/R/include/R_ext')
>>> import RS
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/R/library/RSPython/Python/RS.py", line 1, in ?
    import RSInternal
ImportError: /usr/local/lib/R/library/RSPython/libs/RSInternal.so:
undefined symbol: R_GlobalEnv
>>> import RS
>>> RS.call("rnorm", 10);
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'RS' module has no attribute 'call'

Any idea of what am I doing wrong? Where should R_GlobalEnv
be defined?

Thanks

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es




More information about the R-help mailing list