skip to Main Content

Context:
I have uploaded the zip file of the proper package version related to the R version inside the src dir of the compute instance.
I have the following code:

# R version: 3.5.1
# The script MUST contain a function named azureml_main
# which is the entry point for this module.

# Please note that functions dependant on X11 library
# such as "View" are not supported because X11 library
# is not pre-installed.

# The entry point function MUST have two input arguments.
# If the input port is not connected, the corresponding
# dataframe argument will be null.
#   Param<dataframe1>: a R DataFrame
#   Param<dataframe2>: a R DataFrame
azureml_main <- function(dataframe1, dataframe2)
  {
  print("script run.")
  install.packages("src/dynlm.zip", lib = ".",  repos = NULL, type = "source", dependencies = TRUE)
  print("Install phase passed.")
  library(dynlm)
  print("library phase passed.")
  require(zoo)
  require(stats)
    
  # Specify which Packages are required to run script. The dynlm package needs to be zipped up with this script to work in Azure ML.
  require(data.table)
  
  return(list(dataset1=dataframe1, dataset2=dataframe2))
}

I tried different solutions but I still get the error there is no package called ‘dynlm’ even though I think I clearly specify the installation. What can I do?
Side details: before I did other tries, I did some downgrades

  • pip:
    • azureml-core==1.54.0
    • cryptography<41

let me know if you need more context. I considered dockerizing the code

2

Answers


  1. Chosen as BEST ANSWER

    workaround:

    install.packages("r-cran-dynlm", repos = "https://git.launchpad.net/ubuntu/+source/r-cran-dynlm", dependencies=TRUE)
    

  2. That is because the installation is not successful. You need to check whether the src file present or not. But whatever you uploaded in compute instance it will not be shared while running the pipeline.

    So, possible way is to provide the zip file dataset in port 3 which accepts zip file and extracts it in the folder Script Bundle.

    Next, register the dataset with the downloaded zip file.

    Go to Data and click on create.

    enter image description here

    Give a name and select dataset types as file.

    enter image description here

    then click on From Local Files and upload the package zip file you have.

    Now in pipeline add the data created to 3rd port like shown below.

    enter image description here

    Next use below r script to install it.

    print(list.files('./Script Bundle'))
    install.packages("./Script Bundle/dynlm", repos = NULL, type = "source", dependencies = TRUE)
    

    Since, it is already extracted to Script Bundle give the package path to folder dynlm.

    Output:

    enter image description here

    Also make sure you have all dependencies while loading.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search