I am trying to add a remote GitHub suggested dependency (openxlsx2
) in the rempsyc
package, as such (rempsyc/DESCRIPTION at main · rempsyc/rempsyc · GitHub):
Suggests:
[...]
remotes,
openxlsx2,
Remotes:
github::JanMarvin/openxlsx2
But when attempting to document/install locally (after manually uninstalling openxlsx2
to test it) I get
Warning in (function (dep_name, dep_ver = "*") :
Dependency package 'openxlsx2' not available.
Error in `abort_for_missing_packages()`:
! Dependency package(s) 'openxlsx2' not available.
The command to install the package is remotes::install_github("JanMarvin/openxlsx2")
and it's GitHub can be retrieved from GitHub - JanMarvin/openxlsx2: openxlsx2 - read, write and modify xlsx files. It seems that the Remotes section is being ignored and that it is trying to install the dependency from CRAN and thus fails.
I have tried other remote packages with the same result, and also changing from Suggests:
to Imports:
, and removing the optional github::
bit, with no success so far, so it seems a problem with my own setup. So I have updated all my packages and restarted my computer, RStudio, and R. And now, I am getting this message on start-up:
Error in .rs.parsePackageDependencies(contents, extension) :
object 'partition_yaml_front_matter' not found
When I pushed the change to GitHub to see if it was a local problem and GitHub would run directly, there was an error (on Windows only: R-CMD-check · rempsyc/rempsyc@9e147ff · GitHub):
C:\rtools40\usr\bin\tar.exe --use-compress-program "zstd -d" -xf D:/a/_temp/a1c2b5ca-dcde-4da8-9a76-7dcea8572bd6/cache.tzst -P -C D:/a/rempsyc/rempsyc --force-local
! rlang, fansi, utf8, and vctrs are loaded in other R sessions and have locked
files in your library. The installation will probably fail, unless you quit
from this R session:
• Rterm.exe (5876) in cmd.exe (6908)
ℹ Building openxlsx2 0.2.1.9000
✖ Failed to build openxlsx2 0.2.1.9000
Error: Error: <callr_remote_error: Failed to build source package 'openxlsx2'>
in process 5876
-->
Failed to build source package 'openxlsx2', stdout + stderr:
OE> * installing *source* package 'openxlsx2' ...
OE> Error: package or namespace load failed for 'openxlsx2' in inDL(x, as.logical(local), as.logical(now), ...):
OE> unable to load shared object 'C:/Users/runneradmin/AppData/Local/Temp/RtmpIn5JEg/pkg-lib16f464242299/openxlsx2/libs/x64/openxlsx2.dll':
OE> LoadLibrary failure: The specified procedure could not be found.
OE>
OE> Error: loading failed
OE> Execution halted
OE> ERROR: loading failed
OE> * removing 'C:/Users/RUNNER~1/AppData/Local/Temp/RtmpIn5JEg/pkg-lib16f464242299/openxlsx2'
When I install the package manually and do the checks everything works fine, but I just want to test that the remote install works well for users that will not have the package installed and I cannot make it work so I am afraid that others too won't be able to install it remotely.
In my function, I have the following check:
rlang::check_installed("openxlsx2", reason = "for this function.")
So I try running the function without that package installed to see if it will install it correctly, but here is what I get:
cormatrix_excel2(mtcars)
ℹ The package `openxlsx2` is required for this function.
✖ Would you like to install it?
1: Yes
2: No
Selection: 1
Installing package into ‘D:/Rpackages’
(as ‘lib’ is unspecified)
Error in loadNamespace(x) : there is no package called ‘openxlsx2’
In addition: Warning message:
package ‘openxlsx2’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html
I am not sure what to do and I keep searching online but do not find solutions that work or with my exact problem. Any idea?
At this point I'm wondering whether I need to do a manual workaround like checking if the package is installed (with require
) and install it from GitHub from the function directly if it's not installed? I know this is not good practice but the other things I've tried are not working so far.