ropensci-review-tools / pkgstats

Historical statistics of every R package ever
https://docs.ropensci.org/pkgstats/
17 stars 1 forks source link

external_calls empty #50

Closed chrarnold closed 2 years ago

chrarnold commented 2 years ago

Hi! Thanks for the package. I installed it today and wanted to see in particular the external package references, but unfortunately, this is what I get for the external_calls slot. Input was a Bioconductor package tar.gz (https://www.bioconductor.org/packages/release/bioc/src/contrib/GRaNIE_1.0.5.tar.gz)

GRaNIE_stats$external_calls
[1] tags_line call      tag       file      kind      start     end       package  
<0 rows> (or 0-length row.names)

Any idea why this is not capturing the external libraries that are used?

mpadge commented 2 years ago

Most likely because you haven't got ctags correctly installed. What's the output of the ctags_test() function? Installation is described in a separate vignette. You should see this:

library (pkgstats)
packageVersion ("pkgstats")
#> [1] '0.1.1.3'
path <- "/<local>/<path>/<to>/GRaNIE_1.0.5.tar.gz"
s <- pkgstats (path)
nrow (s$external_calls)
#> [1] 3042

Created on 2022-08-04 by the reprex package (v2.0.1)

chrarnold commented 2 years ago

Thanks for the pointer, I completely missed this requirement. I tried installing it both from within R, and separately from the command line (I have sudo). From within R, the install function failed in the end with Error: Failed to execute 'hash' (No such file or directory), if I leave sudo = TRUE, it fails because there is no prompt asking me for sudo during execution of the function.

I then installed both global and universal-ctags manually on my PC via sudo apt install, but ctags_test still gives FALSE. No idea why. What should I check? Thanks for helping.

mpadge commented 2 years ago

That's wierd, because the hash binary should be installed along with bash. Your best bet might then be to follow the official Linux installation steps. The code in the first block should do the job, with sudo make install as the last step. Note that apt install ctags will not work, because that version has long been abandoned, and the maintained version is a fork of that, so not available via apt. It's probably a good idea to apt remove before proceeding.

If you're inclined and have time to help debug, the internal code is in https://github.com/ropensci-review-tools/pkgstats/blob/main/R/ctags-install.R, mostly in the ctags_make() function which recreates the code linked to above. The hash calls are right at the end of ctags_install(), meaning that those should only be reached after a successful install ... and yet the install does not work for you. If you feel like stepping through that code to debug, it might help anyone else who encounters similar issues.

mpadge commented 2 years ago

@chrarnold I'm going to close this now, but let us know if you encounter any further issues. Thanks.