Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#65 closed enhancement (fixed)

qgis 1.0.1 can't load rpy/rpy2 interface to R

Reported by: lutra Owned by: jef
Priority: major Component: Package
Version: 1.0 Keywords: qgis, 1.0.1, rpy, rpy2, R, pyparsing, simplejson
Cc: a.ghisla@…, carson.farmer@…

Description

In the last two days I tried to make the latest version of QGis (installed trough the osgeo4w installer) work with a couple of R based plugins (Home Range and ManageR). After a few tries, together with the Home Range plugin developer looking for a plugin bug, we realized that the problem was that qgis 1.0.1 can't load the necessary packages to work with R. One of the tests was made using the python console and the Qgis python console and as a matter of fact the latter fails to load rpy/rpy2.

I haven't tested Qgis 1.0.0 from Osgeo4w but I do have tested the preview II installed with the package from Marco Pasetti and there are no problems. No problems also under gnu/linux.

Attachments (1)

python.png (101.5 KB ) - added by lutra 16 years ago.
screenshot of the qgis python console and of the python console

Download all attachments as: .zip

Change History (13)

by lutra, 16 years ago

Attachment: python.png added

screenshot of the qgis python console and of the python console

comment:1 by lutra, 16 years ago

Owner: changed from jef@… to jef

comment:2 by jef, 16 years ago

What python are you using? Looks like it's not osgeo4w's python, if you had rpy/rpy2 working with that python, it would probably work in QGIS, too.

in reply to:  2 comment:3 by lutra, 16 years ago

Replying to jef:

What python are you using? Looks like it's not osgeo4w's python, if you had rpy/rpy2 working with that python, it would probably work in QGIS, too.

I see your point. I would like to give a try to your solution, but among the dependencies of the R based plugins there is rpy/rpy2 that I cannot see in the osgeo4w installer. If I try to install rpy/rpy2 separately it says that can't find python in the registry. Any workaround? If missing it is possible to add rpy/rpy2 to the osgeo4w installer?

comment:4 by aghisla, 16 years ago

ticket #55 has been marked as duplicate of this ticket, even if it was older.

comment:5 by jef, 16 years ago

Type: defectenhancement

comment:6 by aghisla, 16 years ago

ticket #55 refers to missing rpy package inside the installer. Adding it will solve the issue above. Otherwise, the installer should locate and use already installed python.

in reply to:  6 ; comment:7 by jef, 16 years ago

Replying to aghisla:

ticket #55 refers to missing rpy package inside the installer. Adding it will solve the issue above. Otherwise, the installer should locate and use already installed python.

I've packaged python-rpy2. It's available in the testing area (osgeo4w-setup -t) for now. managerR and the home range plugin now load for me.

Due to lack of experience with either of them, I can't judge if they work correctly now. Please test and report back.

Carson: I get an error from manageR. Is that because of R 2.6.8 & rpy2 2.0.8 instead of rpy <=1.0.3 & R <= 2.6.2?

Traceback (most recent call last):
  File ".../.qgis//python/plugins\manageR\manageR.py", line 65, in run
    d = domanageR.Dialog(self.iface)
  File ".../.qgis//python/plugins\manageR\domanageR.py", line 54, in __init__
    set_default_mode(BASIC_CONVERSION)
NameError: global name 'set_default_mode' is not defined

in reply to:  7 ; comment:8 by lutra, 16 years ago

Replying to jef:

Due to lack of experience with either of them, I can't judge if they work correctly now. Please test and report back.

I made testes with the newly packaged rpy2 and versions of R known to work with it: manageR and the HR plugin do install, but while the HR works manageR doesn't exactly because it needs a earlier version of R (that works only with rpy).

From my previous testes the only combination that allow to install and use at the same time manageR and the HR is: R 2.6.2, rpy for this specific version of R and python 2.5.

It is possible to package also rpy (1.0.3) for R 2.6.2 / Python 2.5 ?

Thanks

in reply to:  8 ; comment:9 by jef, 16 years ago

Resolution: fixed
Status: newclosed

Replying to lutra:

It is possible to package also rpy (1.0.3) for R 2.6.2 / Python 2.5 ?

done - python-rpy

in reply to:  9 comment:10 by lutra, 16 years ago

Keywords: pyparsing simplejson added

done - python-rpy

Thanks, it works perfectly. I'll use this ticket to point your attention to other two python dependencies that are not included in the actual installer and that are necessary for two other plugins:

  • Rasterlang plugin depends on python-pyparsing
  • Qgisrest plugin depends on python-simplejson

comment:11 by lutra, 16 years ago

Still making tests installing R based plugins on win xp machines: I noticed that on a machine that had already installed python, numpy and rpy - after having installed qgis trough OSGeo4W (together with python, numpy, rpy) - the plugins ManageR and Home Ranges still had problems installing, behaving like it was not possible to load rpy/rpy2.

Then I removed python, numpy and rpy and the plugins installed well.

Reinstalling python, numpy and rpy seems to have no further effects, as the plugins do uninstall/install without problems.

This could be puzzling for some users.

comment:12 by giohappy, 16 years ago

I can reproduce the last situation reported by lutra. Many windows users have their own python, and related modules. For example, ArcGIS brings it with him. We should improve osgeo4w python / system python integration, maybe using windows registry to catch preinstalled software, and do the necessary workarounds (with the plugin installer) to avoid conflicts.

Note: See TracTickets for help on using tickets.