no applicable method for required_pkgs applied to workflow

Apologies for not being able to generate a reprex, due to limitations in the current system

I am facing a situation in which we have had to copy-paste packages from one system to another while ensuring the same package and R versions. And I am loading all required tidymodels packages step by step, as:

library(tune)
library(generics)
library(workflows)
library(tidymodels)

However, when I try to run tune_grid() from the tune package, a part of the function fails to execute.
Debugging it, I realised the required_packages function was not running correctly, giving the error message no applicable method for 'required_pkgs' applied to an object of workflow.

I cannot get around figuring out how to resolve this as the code works completely fine in old environment, but some hypotheses I am considering are:

  1. Does the order in which I load packages matter?
  2. Can I somehow edit the actual function to force it to "identify" the required packages for a workflow object

image

My session info is:

One option I will be exploring is

  1. To start with a clean environment, unload all packages (except the base ones), and then run the script again (previously, I was restarting R, but realised not all packages are unloaded with it)

I have tried checking the following hypotheses but to no avail:

  1. Manually adding a default library to the .libPaths
  2. Clearing environment and detaching all packages to start from a clean slate
  3. Ensuring that the generics package is loaded and the function recognised by the system, only for it to fail when it is called from within the tune_grid function
  4. Manually changing the function with assignInNamespace("required_pkgs", my_func, ns = "generics")

If anyone has a clue, or a suggestion for me to add to my hypotheses, I will be very thankful

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.