I am currently using
R ver. 3.4.1 installed on C:\R\R-3.4.1,
installed and loaded Packages: RQGIS
, sp
, raster
.
QGIS ver. 2.18.11 installed with OSGeo installer on C:\OSGeo4W64\apps\qgis.
In R I am trying to use the installed RQGIS package to enable QGIS functions via R as shown in the example of the packages GitHub page (https://github.com/jannes-m/RQGIS), I was following.
My environment is set to:
set_env()
$root
[1] "C:\\OSGeo4W64"
$qgis_prefix_path
[1] "C:\\OSGeo4W64\\apps\\qgis"
$python_plugins
[1] "C:\\OSGeo4W64\\apps\\qgis\\python\\plugins"
But unfortunately I always get errors at the following line of code:
library("RQGIS")
find_algorithms(search_term = "([Pp]olygon)(centroid)")
Error in py_str_impl(object) :
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 77807: ordinal not in range(128)
Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: 'file' object has no attribute 'getvalue'
Detailed traceback:
File "C:/R/library/reticulate/python\rpytools\output.py", line 14, in end_stdout_capture
output = sys.stdout.getvalue()
I have already tried reinstalling QGIS, R and all depending packages for a couple of times.
Now I checked Spacedman's suggestions, see below.
For R:
> reticulate::py_config()
python: C:\OSGeo4W64\bin\python.exe
libpython: C:/OSGeo4W64/bin/python27.dll
pythonhome: C:\OSGeo4W64\apps\Python27
version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
Architecture: 64bit
numpy: C:\OSGeo4W64\apps\Python27\lib\site-packages\numpy.
numpy_version: 1.12.1
python versions found:
C:\OSGeo4W64\bin\python.exe
C:\OSGEO4~1\bin\python.exe
And in QGIS I entered:
import sys
sys.executable
'C:\\OSGEO4~1\\bin\\qgis-bin.exe'
Unfortunately I still don't know how to get it up running correctly.
reticulate
is causing the error. Do you have the latest CRAN version ofreticulate
? – pat-s Jul 23 '17 at 22:00reticulate::py_config()
in R. Then in the QGIS python console doimport sys
andsys.executable
. Thesys.executable
in QGIS should be the same as thepython:
value in the config. Edit your question and include those outputs. – Spacedman Jul 24 '17 at 8:31RQGIS
. Have you tried to look for solutions for this problem? See for example stackoverflow.com/questions/9942594/… or gis.stackexchange.com/questions/59521/… – pat-s Jul 26 '17 at 10:23