Ivan Krylov
2023-Jun-06 17:25 UTC
[R-sig-Debian] why is KEYWORDS.db not in '/usr/lib/R/doc/' but in '/usr/share/R/doc/'?
Hello Johan and welcome to R-SIG-Debian! ? Tue, 6 Jun 2023 18:55:27 +0200 Johan Andresen <johan.andresen at 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
Johan Andresen
2023-Jun-06 20:29 UTC
[R-sig-Debian] why is KEYWORDS.db not in '/usr/lib/R/doc/' but in '/usr/share/R/doc/'?
Thanks, Dirk and Ivan Now I better understand what is going on. Sweet this help is already in the github issue. Johan Den tirs. 6. jun. 2023 kl. 19.25 skrev Ivan Krylov <krylov.r00t at gmail.com>:> Hello Johan and welcome to R-SIG-Debian! > > ? Tue, 6 Jun 2023 18:55:27 +0200 > Johan Andresen <johan.andresen at 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 >[[alternative HTML version deleted]]