[R-sig-Debian] why is KEYWORDS.db not in '/usr/lib/R/doc/' but in '/usr/share/R/doc/'?

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Tue Jun 6 19:25:03 CEST 2023


Hello Johan and welcome to R-SIG-Debian!

В Tue, 6 Jun 2023 18:55:27 +0200
Johan Andresen <johan.andresen using gmail.com> пишет:

> I feel lucky to have found out that `/doc/KEYWORDS.db` is in
> `/usr/share/R/`, not in `usr/lib/R/` where rpy2 in python apparently
> looks for it when trying to search help in R from the python
> environment. it returned this error: `cannot open file
> '/usr/lib/R/doc/KEYWORDS.db': No such file or directory`.
> 
> What to do now?
> - is this a problem with rpy2 looking for `/doc/KEYWORDS.db` that
> should not be in `usr/lib/R/`? -> *edit its script to point at the
> correct path?*

It seems that R.home('doc') doesn't return the right path when running
from under rpy2 for some reason. (With Debian packages, it should
return "/usr/share/R/doc", not "/usr/lib/R/doc".)

It's documented in ?R.home that on Unix-like OSes, the function relies
on environment variables like R_DOC_DIR being set during startup.

How does rpy2 launch R? It looks like rpy2 drives an embedded R like a
frontend. I think that at least under Unix-alikes, the required
environment variables are set by launching the frontend via `R CMD
/path/to/frontend/executable` (see WRE 8.1 [*]), except this isn't
convenient for the Python process. I guess rpy2 could obtain the
additional variables the same way it currently extracts LD_LIBRARY_PATH.

> Johan
> with his first question on a, not just thus, mail list

>	[[alternative HTML version deleted]]

One tiny detail: this mailing list (and other R project mailing lists)
removes the HTML part of the messages it processes, so it's best to
compose in plain text. But the rest of it you're doing absolutely right!

-- 
Best regards,
Ivan

[*]
https://cran.r-project.org/doc/manuals/R-exts.html#Embedding-R-under-Unix_002dalikes



More information about the R-SIG-Debian mailing list