Re: [Rpy] Using rpy2 with lib-apache2-mod-python

2008-10-20 Thread Eric Bell
No change in behavior. I've simplifed my python script and added the
import rpy2.rinterface as instructed. I've stopped and started the
apache server as appropriate voodoo.

Seems to me if I can't execute the library() call then it makes sense
that R functionality in the non-base libraries won't be available.

Other info: I'm running on Unbuntu Gusty ... I couldn't find a packaged
shared libraries version of R so I built it myself. I did have R
installed previously using the Synaptic package manager and subsequently
deinstalled when I built the shared library version. I've just confirmed
that Synatpic indicates that R is not installed. I notice that if I do a
printenv in a shell, there's no R_HOME variable defined. Should there
be? I recall having to futz with this when I was trying to install the
RSPython extension...the builds kept failing because R_HOME was point to
the wrong place.

I'm happy to run other tests if you tell me what to do.

--eric


PYTHON SCRIPT


from mod_python import apache

import rpy2.rinterface as ri

# this must go before the import rpy2 
ri.set_initoptions(('rpy2','--verbose','--vanilla','--nosave'))

import rpy2
from rpy2 import robjects

def handler(req):
r = robjects.r

r(library())

req.content_type = 'html'
req.write(HTMLBODYHello beautiful
World!BR/BODY/HTML) 
return apache.OK


Traceback:


  File /usr/lib/python2.5/site-packages/mod_python/importer.py, line 1537, in 
HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File /usr/lib/python2.5/site-packages/mod_python/importer.py, line 1229, in 
_process_target
result = _execute_target(config, req, object, arg)

  File /usr/lib/python2.5/site-packages/mod_python/importer.py, line 1128, in 
_execute_target
result = object(arg)

  File /var/www/apache2-default/test_python/test1.py, line 14, in handler
r(library())

  File /usr/lib/python2.5/site-packages/rpy2/robjects/__init__.py, line 501, 
in __call__
res = self.eval(p)

  File /usr/lib/python2.5/site-packages/rpy2/robjects/__init__.py, line 381, 
in __call__
res = super(RFunction, self).__call__(*new_args, **new_kwargs)


RRuntimeError: Error in gzfile(file, rb) : invalid 'encoding' argument
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] Using rpy2 with lib-apache2-mod-python

2008-10-20 Thread Eric Bell
I performed the unit testing and here are my results:

Note: Software Versions: R 2.7.2 Python 2.5.1

$ python
Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40) 
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type help, copyright, credits or license for more information.
 import rpy2.tests
 import unittest
 tr = unittest.TextTestRunner(verbosity = 1)
 suite = rpy2.tests.suite()
 tr.run(suite)

..Error in .Primitive([)(0:10, list(a, b, c)) : 
  invalid subscript type 'list'

E..FLoading
required package: splines

..Error in function (x)  : object y not found

...Error in .Primitive(sum)(c(a, b, c, d, e, f, g, h,
i,  : 
  invalid 'type' (character) of argument

..F..
==
ERROR: testNewString
(rpy2.rinterface.tests.test_SexpVector.SexpVectorTestCase)
--
Traceback (most recent call last):
  File
/usr/lib/python2.5/site-packages/rpy2/rinterface/tests/test_SexpVector.py, 
line 95, in testNewString
ri.NA_STRING[0]
ValueError: Cannot handle type 9

==
FAIL: testNewWithoutInit
(rpy2.rinterface.tests.test_SexpVector.SexpVectorTestCase)
--
Traceback (most recent call last):
  File
/usr/lib/python2.5/site-packages/rpy2/rinterface/tests/test_SexpVector.py, 
line 37, in testNewWithoutInit
self.assertTrue(False) # worked when tested, but calling
endEmbeddedR causes trouble
AssertionError

==
FAIL: testCallErrorWhenEndedR
(rpy2.rinterface.tests.test_EmbeddedR.EmbeddedRTestCase)
--
Traceback (most recent call last):
  File
/usr/lib/python2.5/site-packages/rpy2/rinterface/tests/test_EmbeddedR.py, 
line 30, in testCallErrorWhenEndedR
self.assertTrue(False) # worked when tested, but calling
endEmbeddedR causes trouble
AssertionError

--
Ran 144 tests in 0.269s

FAILED (failures=2, errors=1)
unittest._TextTestResult run=144 errors=1 failures=2
 

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list


Re: [Rpy] Using rpy2 with lib-apache2-mod-python

2008-10-20 Thread Eric Bell
Resolved ... or a least made to go away.

It appears that the problem was caused in part due to loading another
apache module supplied by R/Apache, as described at
http://biostat.mc.vanderbilt.edu/rapache/ R/Apache is a project
dedicated to embedding the R interpreter inside the Apache 2.0 (and
beyond) web server

I was looking through the apache error log, and noticed the lines:

Error in .Call(R_isMethodsDispatchOn, onOff, PACKAGE =
base) : 
  Incorrect number of arguments (2), expecting 1 for
R_isMethodsDispatchOn

I don't know if the R/Apache r_module is causing this or rpy2, but I
decided to disable the r_module and voila, my script works ... well
actually it doesn't, because now I get another error, but that's due to
trying to use a call to JPEG, which requires that an X11 device be
present, which it won't be running inside a web server.

--eric


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list