Bugs item #2830501, was opened at 2009-07-31 21:46
Message generated for change (Comment added) made by aghisla
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=453021&aid=2830501&group_id=48422
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: rpy2
Status: Pending
Resolution: None
Priority: 5
Private: No
Submitted By: Tim Clark (mudiver)
Assigned to: lgautier (lgautier)
Summary: rpy2 bug in qGIS - Home Range pluging not working
Initial Comment:
I am not a developer so sorry if this doesn't have everything you need. Please
ask and I will be happy to supply additional information.
I am trying to run the Home Range plugin from within qGIS. This plugin calls
the package 'adehabitat' from within R. Adehabitat loads and runs fine from
within R, as does ade4 and gdal (both required by adehabitat). I contacted
Anna Ghisla, the developer of the plugin, and she suggested some tests and now
thinks I have a bug with RPy2. I tried running Home Range from the GUI of
qGIS, and also from the Python console (as Anna suggested). Both produced
errors (see below). I have the following system/software:
Dell Precision 390 running Windows XP sp 3
R2.9.1 with adehabitat, ade4, and rgdal
from OSGeo4W I have installed:
qGIS 1.0.2-2
Python 2.5.2-1
Python-numpy
Python-qGIS
Python-rpy2
Python-Win32
When I try to run adehabitat from the Python console within qGIS I get the
following error:
>>> import rpy2.robjects as robjects
>>> robjects.r.require("adehabitat")
RRuntimeError: Error: package 'ade4' could not be loaded
>>> robjects.r.require("ade4")
[1] FALSE
Running the Home Range plugin from the qGIS GUI gets the following error:
An error has occured while executing Python code:
Traceback (most recent call last):
File "C:/Documents and
Settings/DAR/.qgis//python/plugins\HomeRange_plugin\HRplugin_dialog.py", line
75, in
QObject.connect(self.buttonBox, SIGNAL("accepted()"), lambda mth=mth:
self.run(mth))
File "C:/Documents and
Settings/DAR/.qgis//python/plugins\HomeRange_plugin\HRplugin_dialog.py", line
171, in run
checkPackages("adehabitat")
File "C:/Documents and
Settings/DAR/.qgis//python/plugins\HomeRange_plugin\HRplugin_algorithm.py",
line 57, in checkPackages
if not robjects.r.require(package):
File "C:\OSGeo4W\apps\Python25\lib\site-packages\rpy2\robjects\__init__.py",
line 422, in __call__
res = super(RFunction, self).__call__(*new_args, **new_kwargs)
RRuntimeError: Error: package 'ade4' could not be loaded
Python version:
2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
Python path:['C:/OSGeo4W/apps/qgis/./python', 'C:/Documents and
Settings/DAR/.qgis//python/plugins', 'C:/OSGeo4W/apps/qgis/./python/plugins',
'C:\\OSGeo4W\\apps\\gdal-16\\pymod', 'C:\\Program Files\\ArcGIS\\bin',
'C:\\WINDOWS\\system32\\python25.zip', 'C:\\OSGeo4W\\apps\\Python25\\DLLs',
'C:\\OSGeo4W\\apps\\Python25\\lib',
'C:\\OSGeo4W\\apps\\Python25\\lib\\plat-win',
'C:\\OSGeo4W\\apps\\Python25\\lib\\lib-tk', 'C:\\OSGeo4W\\apps\\qgis\\bin',
'C:\\OSGeo4W\\apps\\Python25',
'C:\\OSGeo4W\\apps\\Python25\\lib\\site-packages',
'C:\\OSGeo4W\\apps\\Python25\\lib\\site-packages\\win32',
'C:\\OSGeo4W\\apps\\Python25\\lib\\site-packages\\win32\\lib',
'C:\\OSGeo4W\\apps\\Python25\\lib\\site-packages\\Pythonwin',
'C:\\OSGeo4W\\apps\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode',
'C:\\Documents and Settings\\DAR\\.qgis\\python\\plugins\\fTools\\tools']
I understand this has been a problem on previous versions but was supposed to
have been fixed (ticket at: https://trac.faunalia.it/animove/ticket/7)
Thanks for looking into this. Please let me know if you need additional
information.
Tim
----------------------------------------------------------------------
Comment By: Anne Ghisla (aghisla)
Date: 2009-08-03 17:15
Message:
I tried to reproduce the bug, and in the meanwhile I generated and solved
other problems..
I used to work with Python 2.5, not OSGeo4w's one, and rpy2 v 2.0.0.
Adehabitat was loaded normally.
I upgraded rpy2 to 2.0.3 (the one shipped with OSGeo4w) and the bug still
didn't appear.
In QGIS, import rpy2.robjects as robjects generated an ImportError related
to import win32api. I solved it merging site-packages folder of QGIS'
Python with the one of the independent Python install on my pc - all works
fine now.
HTH,
Anne
----------------------------------------------------------------------
Comment By: lgautier (lgautier)
Date: 2009-08-01 10:50
Message:
I would like to hear if anyone can reproduce on win32 what you are
experiencing (all appear to work fine UNIX-like system.
As the error message tells, you cannot attach the package "adehabitat" to
your R sessions because its dependency "ade4" cannot be attached itself,
and this prompts me to suspect that you have several versions of R
installed and that rpy2 is not picking the one you wish it would.
What is the outcome of doing:
import rpy2
import rpy2.robjects as robjects
print(rpy2.__version__)
print(robjects.r)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=453021&aid=2830501&group_id=48422
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list