[Qgis-user] Qgis/Rpy spqr plugin

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Jun 13 00:09:57 PDT 2008


Tim Sutton wrote:
> Hi
> 
> I guess this is one for you Barry?

>>   import doHistogram
>>  File "C:/Program Files/Quantum GIS/./python/plugins\spqr\doHistogram.py",
>> line 6, in
>>   import opsR
>>  File "C:/Program Files/Quantum GIS/./python/plugins\spqr\opsR.py", line 7,
>> in
>>   import rpy
>>  File "C:\Python25\Lib\site-packages\rpy.py", line 346, in
>>   r = R()
>>  File "C:\Python25\Lib\site-packages\rpy.py", line 286, in __init__
>>   _rpy.r_init(HAS_NUMERIC);
>> RuntimeError: Only one R object may be instantiated per session

  I'm not sure how my code can get this error. All I'm doing is 'import 
rpy', and then inside the rpy code it tries to instantiate a new R 
object. No matter how many times you do 'import rpy' or 'from rpy import 
r', the rpy code should only instantiate one R object. You can force it 
with:

  >>> import rpy  # this instantiates an R object
  >>> rpy.R()     # try to make another one
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "c:\Python25\lib\site-packages\rpy.py", line 286, in __init__
     _rpy.r_init(HAS_NUMERIC);
RuntimeError: Only one R object may be instantiated per session

Things to try:

  * deinstall spqr (just move it outof the plugins folder) and check rpy 
functionality:
   - start qgis, start python console from plugins menu
   - try 'from rpy import r' and 'r.plot(range(10))'
   - if that doesn't work, then it's not an spqr problem.

  * does rpy work from the command line (outside of qgis)? Run python, 
then try the import and plot commands. If that fails, then it's not a 
qgis problem.

  Can't think of anything else to try at the moment...

Barry




More information about the Qgis-user mailing list