On 2011-04-22 17:22, Brent Pedersen wrote:
> On Fri, Apr 22, 2011 at 9:03 AM, Brent Pedersen<bpede...@gmail.com>  wrote:
>> On Fri, Apr 22, 2011 at 8:34 AM, Brent Pedersen<bpede...@gmail.com>  wrote:
>>> hi, I am getting some errors with the latest version of rpy2, any ideas?
>>>
>>>
>>>
>>> $ python rpy/tests.py
>>> Error in sub("[[:blank:]]*([[:alnum:]]+)", "\\1", dp) :
>>>   7 arguments passed to .Internal(sub) which requires 8
>>> Traceback (most recent call last):
>>>   File "rpy/tests.py", line 3, in<module>
>>>     import rpy2.robjects.tests
>>>   File 
>>> "/home/brentp/local/lib/python2.7/site-packages/rpy2/robjects/__init__.py",
>>> line 17, in<module>
>>>     from rpy2.robjects.robject import RObjectMixin, RObject
>>>   File 
>>> "/home/brentp/local/lib/python2.7/site-packages/rpy2/robjects/robject.py",
>>> line 9, in<module>
>>>     class RObjectMixin(object):
>>>   File 
>>> "/home/brentp/local/lib/python2.7/site-packages/rpy2/robjects/robject.py",
>>> line 22, in RObjectMixin
>>>     __show = rpy2.rinterface.baseenv.get("show")
>>> LookupError: 'show' not found
>>>
>>>
>>> $ uname -a
>>> Linux ilmn-qm.ucdenver.pvt 2.6.18-194.3.1.el5 #1 SMP Sun May 2
>>> 04:17:42 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
>>> $ python --version
>>> Python 2.7.1
>>> $ python -c "import rpy2; print rpy2.__version__"
>>> 2.2.0beta  # (it's revision aad34041491f)
>>> $ R --version | head -n 1
>>> R version 2.13.0 (2011-04-13)
>>>
>> this also happens with R version 2.12.2
>>
> Sorry for the noise. I fixed this my messing with my LD_LIBRARY_PATH
> and saw this: 
> https://bitbucket.org/lgautier/rpy2/issue/46/lookuperror-show-not-found
>
> I do find that with 2.2 (aad34041491f), i get
> ValueError: Nothing can be done for the type<type 'numpy.ndarray'>  at
> the moment.
>
> even after import numpy2ri whereas the same code works fine in 2.19
> (0e5a13fa842e)

The conversion is no longer implicit with the import:
http://rpy.sourceforge.net/rpy2/doc-2.2/html/numpy.html#from-numpy-to-rpy2
(I am noting now that the documentation is lacking /how/ to perform the 
conversion... because I left this part undecided about how to have it.
That's what betas are for ;-) )

In the meanwhile, add the following in the beginning of your main Python 
file(s):

import rpy2.robjects as robjects
import rpy2.robjects.numpy2ri as rpyn

robjects.conversion.py2ri = rpyn.numpy2ri
robjects.conversion.ri2numpy = rpyn.ri2numpy

Sorry for the inconvenience.


L.

> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been
> demonstrated beyond question. Learn why your peers are replacing JEE
> containers with lightweight application servers - and what you can gain
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list


------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to