r-spatial / RQGIS3

GNU Lesser General Public License v3.0
69 stars 19 forks source link

error running open_app #14

Closed tylerbhampton closed 4 years ago

tylerbhampton commented 5 years ago

I have QGIS 3.4 installed, via the OSGeo4W64 installer. Getting the error message "ImportError: No module named builtins". The other "error running open_app" forums haven't helped me.

> library("RQGIS")
> set_env()
$`root`
[1] "C:/Program Files/QGIS 3.4"
$qgis_prefix_path
[1] "C:/Program Files/QGIS 3.4/apps/qgis"
$python_plugins
[1] "C:/Program Files/QGIS 3.4/apps/qgis/python/plugins"

> open_app()
Error in py_run_string_impl(code, local, convert) : 
  ImportError: No module named builtins
> RQGIS::qgis_session_info()
Error in py_run_string_impl(code, local, convert) : 
  NameError: name 'RQGIS' is not defined

Session info:

> version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.1                         
year           2018                        
month          07                          
day            02                          
svn rev        74947                       
language       R                           
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray    
jannes-m commented 5 years ago

Please use RQGIS3.

huanfachen commented 4 years ago

I met the same problem when using QGIS3.

The underlying problem is here: https://stackoverflow.com/questions/27495752/no-module-named-builtins

My solution is:

  1. in cmd, cd to the QGIS folder containing python.exe (eg, QGIS 3.6/apps/qgis/python/plugins), then run the command to install the future package: python -m pip install future Make sure the installation is successful.
  2. Restart R. Then rerun RQGIS3::open_app() Success.
dianinafitri commented 4 years ago

heading the sama issue here use QGIS 3.4 with RQGIS3 installed

open_app() Error in py_run_string_impl(code, local, convert) : ImportError: DLL load failed: The specified procedure could not be found.

Detailed traceback: File "", line 1, in File "C:\OSGeo4W64\apps\qgis\python\qgis\core__init__.py", line 25, in from qgis._core import *

qgis_session_info() Error in py_get_attr_impl(x, name, silent) : AttributeError: module 'main' has no attribute 'RQGIS3' sessionInfo() R version 3.6.2 (2019-12-12) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale: [1] LC_COLLATE=English_Indonesia.1252 LC_CTYPE=English_Indonesia.1252 LC_MONETARY=English_Indonesia.1252 [4] LC_NUMERIC=C LC_TIME=English_Indonesia.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] rgdal_1.4-8 raster_3.0-7 sf_0.8-0 RQGIS3_1.0.1.9000 reticulate_1.14 sp_1.3-2

loaded via a namespace (and not attached): [1] Rcpp_1.0.3 magrittr_1.5 rappdirs_0.3.1 units_0.6-5 hms_0.5.3 lattice_0.20-38
[7] R6_2.4.1 rlang_0.4.2 stringr_1.4.0 tools_3.6.2 parallel_3.6.2 grid_3.6.2
[13] KernSmooth_2.23-16 e1071_1.7-3 DBI_1.1.0 class_7.3-15 tibble_2.1.3 crayon_1.3.4
[19] readr_1.3.1 vctrs_0.2.1 codetools_0.2-16 zeallot_0.1.0 stringi_1.4.3 compiler_3.6.2
[25] pillar_1.4.3 backports_1.1.5 classInt_0.4-2 jsonlite_1.6 pkgconfig_2.0.3

jannes-m commented 4 years ago

I have just installed the latest QGIS LTR version (3.14) on Windows, and open_app() works as expected. Maybe you have to specify the path to your QGIS installation, this is necessary if you have multiple versions of QGIS on your system. For example,

library("RQGIS3")
set_env("C:/Program Files/QGIS 3.4/")
open_app()
qgis_session_info()
AlvaroMCMC commented 3 years ago

I have the same issue:

I run this:

library("RQGIS3")

then:

set_env()

output:
$root
[1] "C:/Program Files/QGIS 3.14"

$qgis_prefix_path
[1] "C:/Program Files/QGIS 3.14/apps/qgis"

$python_plugins
[1] "C:/Program Files/QGIS 3.14/apps/qgis/python/plugins"

$platform
[1] "Windows"

then:

set_env("C:/Program Files/QGIS 3.14/")

output:

$root
[1] "C:/Program Files/QGIS 3.14"

$qgis_prefix_path
[1] "C:/Program Files/QGIS 3.14/apps/qgis"

$python_plugins
[1] "C:/Program Files/QGIS 3.14/apps/qgis/python/plugins"

then:

open_app()
output:
Error in py_run_string_impl(code, local, convert) : 
  ImportError: DLL load failed: No se encontró el proceso especificado.

I try:

find_algorithms(search_term = "centroid", name_only = TRUE)
output:
Error in py_get_attr_impl(x, name, silent) : 
  AttributeError: module '__main__' has no attribute 'RQGIS3'