-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Error on qgis_configure #176
Comments
Does this reproduce the error? qgis_algorithms(query = TRUE, quiet = FALSE) If so, where does it happen... try: result <- qgis_run(args = c("list", "--json"), encoding = "UTF-8")
result_parsed <- jsonlite::fromJSON(result$stdout) Also provide the output of: qgis_version(debug = TRUE)
sessioninfo::session_info() # if needed, first do install.packages("sessioninfo")
system("apt policy qgis") There's some chance it would pose no problem with the current QGIS release (3.32 + backports in LTR 3.28.x), which however is not built by the QGIS community for Ubuntu 20.04 (latest Ubuntu LTS is 22.04). |
Hi Floris, Thanks for your prompt response.
and here is the outcome when I execute
Error in strsplit(qgisprocess_cache$version, "-") : non-character argument
qgis:
Installed: 1:3.26.3+32focal-ubuntugis
Candidate: 1:3.26.3+32focal-ubuntugis
Version table:
*** 1:3.26.3+32focal-ubuntugis 500
500 https://qgis.org/ubuntugis focal/main amd64 Packages
100 /var/lib/dpkg/status
3.22.7+dfsg-1~focal2 500
500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu focal/main amd64 Packages
3.10.4+dfsg-1ubuntu2 500
500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages |
Thank you!
Try to rerun as:
|
I am afraid it yields the same:
and the backtrace:
|
And this?
|
This time the error is different: Error: 'qgis_query_path' is not an exported object from 'namespace:qgisprocess' As though |
Sorry, you need to do |
I had checked it out ;o)) Error in if (qgisprocess_cache$path == "qgis_process") { :
argument is of length zero |
Also if you restart R? |
FYI, here is the environment I am using:
Everything works perfectly fine otherwise. |
So, as you directed, I rebooted the whole container. |
OK thanks. Then let's go the terminal to check things with QGIS first. Can you run:
|
|
BTW, I have found NO indication on how to fix the issue above, which I have encountered before... |
Try:
|
I get: |
|
Here you go: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-stsinc'
QGIS 3.26.3-Buenos Aires 'Buenos Aires' (65e4edfdad)
QGIS code revision 65e4edfdad
Qt version 5.12.8
Python version 3.8.10
GDAL/OGR version 3.4.3
PROJ version 8.2.0
EPSG Registry database version v10.038 (2021-10-21)
GEOS version 3.10.2-CAPI-1.16.0
SQLite version 3.31.1
OS Ubuntu 20.04.6 LTS |
Does this work too ?
|
Yup (correction): QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-stsinc'
6525 |
In a new R session, can you run
Which gives: TitleSome code
#> Some output |
BTW if you want to get rid of the XDG_RUNTIME_DIR warning, have a look at https://stackoverflow.com/questions/59790350 |
So, after rebooting the Proxmox CT, I get far less than what you mentioned: algorithms : NULL
loaded_from : NULL
path : NULL
plugins : NULL
use_json_output : NULL
version : NULL |
Thanks. What did BTW a typical output would be (ignore the fact I'm using a locally built QGIS here): > library(qgisprocess)
Attempting to load the package cache ... Success!
QGIS version: 3.33.0-Master, development state 4e83c82a
Having access to 1973 algorithms from 14 QGIS processing providers.
Run `qgis_configure(use_cached_data = TRUE)` to reload cache and get more details.
> ls.str(envir = qgisprocess:::qgisprocess_cache)
algorithms : tibble [1,973 × 24] (S3: tbl_df/tbl/data.frame)
loaded_from : chr "/home/floris/.cache/R-qgisprocess/cache-0.1.0.rds"
path : chr "/home/floris/git_repositories2/QGIS/build-4e83c82a/output/bin/qgis_process"
plugins : tibble [10 × 2] (S3: tbl_df/tbl/data.frame)
use_json_output : logi TRUE
version : chr "3.33.0-Master, development state 4e83c82a" |
You know, it is improving since I applied the fix to XDG_RUNTIME_DIR. |
Probably because it was loaded already. First restart R, then it should say something. |
(unfortunately) I spoke too fast.... Attempting to load the package cache ... No cache found.
Will try to reconfigure qgisprocess and build new cache ...
>>> PROBLEM encountered: couldn't build package cache! <<<
The 'qgis_process' command-line utility was either not found or
did not fulfil the needs to build the package cache.
Please run `qgis_configure()` to fix this and rebuild the cache.
See its documentation if you need to preset the path of qgis_process.
If the problem persists, make sure that you correctly installed QGIS
for your operating system using the instructions at
https://download.qgis.org. |
And when I tried to |
Please paste the output anyway, there have been several. I.e. does it report a QGIS version for example? |
getOption('qgisprocess.path') was not found.
Sys.getenv('R_QGISPROCESS_PATH') was not found.
Trying 'qgis_process' on PATH...
Success!
Now using 'qgis_process' in the system PATH.
>>> If you need another installed QGIS instance, run `qgis_configure()`;
see `?qgis_configure` if you need to preset the path of 'qgis_process'.
QGIS version is now set to: 3.26.3-Buenos
Using JSON for output serialization.
Using JSON for input serialization.
1 out of 4 available processing provider plugins are enabled.
parse error: premature EOF
{ "gdal_version": "3.4.3", |
Thanks!
Everything should be UTF-8 by default in So now my questions for the new state are:
|
However when I used your first (malformed) So I do believe it's about those characters, and you already hit the solution I think. |
BTW the 'NO carriage return after the last curly brace' (#176 (comment)) is normal and shouldn't be the problem. |
I tried commenting out the |
As per your question above, I executed
|
Then I ran: result <- withr::with_envvar(
c(QT_QPA_PLATFORM="offscreen"),
processx::run("qgis_process", c("list", "--json"), encoding = "UTF-8")
)
str(result) And I got the XDG error again -- it had disappeared! List of 4
$ status : int 0
$ stdout : chr "{\n \"gdal_version\": \"3.4.3\",\n \"geos_version\": \"3.10.2-CAPI-1.16.0\",\n \"proj_version\": \"Rel. 8.2."| __truncated__
$ stderr : chr "QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'\n"
$ timeout: logi FALSE |
And Error: parse error: premature EOF
{ "gdal_version": "3.4.3",
(right here) ------^ |
NB. I know why I got the XDG error: I executed R from No, I tried executing |
Thanks for pursuing this. Indeed the XDG error still needs more attention; from what we've seen it causes the trouble. You can also set |
OK, following your advice, I added |
Do you think I should add a bug report about |
Including {qgisprocess} I assume?
No, because the XDG Base Directory Specification ( $ echo $XDG_RUNTIME_DIR
/run/user/1000 Anyway it is good to have this documented here, so that future users can find this too. |
Nope, still behaving the same. And when executing 1 out of 3 available processing provider plugins are enabled.
parse error: premature EOF
{ "gdal_version": "3.4.3",
(right here) ------^ |
I have to go to a meeting now. Thank you again for your tenacity. Hope we will overcome... |
Well, on second thought, you could post an issue in the QGIS repo saying that JSON strings exported by
|
It does not complain, so I assume it works ;o)) |
So then you probably still have the XDG stderr too, as in your #176 (comment)? |
Well, |
To sum it up:
parse error: premature EOF
{ "gdal_version": "3.4.3",
(right here) ------^ |
So a bit of an incoherence here. |
|
No, as soon as I restart R, the problem with the cache occurs again. |
You can now also install qgisprocess 0.1.0.9177 as follows:
It should give you more feedback and is less likely to end up in an unusable state. I.e., things like |
Sidenote: rerunning |
I have installed the last version (above) and got, as expected, the |
OK thanks. In conclusion:
(*) however a missing $ QT_QPA_PLATFORM="offscreen" XDG_RUNTIME_DIR="" qgis_process list --json | tail -5
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-floris'
"python_version": "3.10.12",
"qgis_code_revision": "67d46100b5",
"qgis_version": "3.32.3-Lima",
"qt_version": "5.15.3"
} But if you can reproduce the contrasting behaviours in the shell (see #176 (comment)), then that's a good starting point for an issue at QGIS! |
Thanks! |
Hi,
qgisprocess
When I execute
qgisprocess::qgis_configure()
, I get this message then the error:Please help,
S.
The text was updated successfully, but these errors were encountered: