locked
Insall package in R ( zip file not found) RRS feed

  • Question

  • Hi

    I tried to install a package called "rworldmap" and still couldn't. could you pls help me what's wrong?

    here is my code:

    #Installing a new package in R
    data.set <- data.frame(installed.packages())
    install.packages("src/rworldmap.zip", lib = ".", repos = NULL, verbose = TRUE)
    success <- library("rworldmap", lib.loc = ".", logical.return = TRUE, verbose = TRUE)

    here is View output log:

    [ModuleOutput] The following files have been unzipped for sourcing in path=["src"]:
    [ModuleOutput]
    [ModuleOutput]                                             Name  Length                Date
    [ModuleOutput]
    [ModuleOutput] 1                                     rworldmap/       0 2015-12-13 05:29:00
    [ModuleOutput]
    [ModuleOutput] 2                             rworldmap/CITATION     566 2015-12-13 05:29:00
    [ModuleOutput]
    [ModuleOutput] 3                                rworldmap/data/       0 2015-12-13 05:29:00
    [ModuleOutput]
    [ModuleOutput] 4                rworldmap/data/coastsCoarse.rda   67428 2015-12-13 05:29:00
    [ModuleOutput]
    [ModuleOutput] 5             rworldmap/data/countriesCoarse.rda  171396 2015-12-13 05:29:00
    [ModuleOutput]
    [ModuleOutput] 6  rworldmap/data/countriesCoarseLessIslands.rda  139500 2015-12-13 05:29:00
    [ModuleOutput]
    [ModuleOutput] 7                rworldmap/data/countriesLow.rda 1103616 2015-12-13 05:29:00
    [ModuleOutput]
    [ModuleOutput] 8               rworldmap/data/countryExData.rda   17932 2015-12-13 05:29:00

    ......

    ModuleOutput] Loading objects:
    [ModuleOutput]
    [ModuleOutput] Warning messages:
    [ModuleOutput]
    [ModuleOutput] 1: In strptime(x, format, tz = tz) :
    [ModuleOutput]
    [ModuleOutput]   unable to identify current timezone 'C':
    [ModuleOutput]
    [ModuleOutput] please set environment variable 'TZ'
    [ModuleOutput]
    [ModuleOutput] 2: In strptime(x, format, tz = tz) : unknown timezone 'localtime'
    [ModuleOutput]
    [ModuleOutput] 3: In data.row.names(row.names, rowsi, i) :
    [ModuleOutput]
    [ModuleOutput]   some row.names duplicated: 85,137,165,195,214,215,247,254,262,280,288,289,290,330,340,365,373,411,482,491,503,504 --> row.names NOT used
    [ModuleOutput]
    [Stop]     DllModuleMethod::Execute. Duration = 00:00:08.9416913
    [Critical]     Error: Error 0063: The following error occurred during evaluation of R script:
    ---------- Start of error message from R ----------
    zip file 'src/rworldmap.zip' not found

    Sunday, December 13, 2015 10:39 PM

Answers

  • Hi Hanieh,

    I suspect this has something to do with the dependencies for the package (rworldmap).

    For the package (rworldmap) https://cran.r-project.org/web/packages/rworldmap/index.html, you would need packages: sp, maptools, fields.

    Now maptools is pre-installed in Azure ML, but fields and sp need to be installed.

    For the package: sp: https://cran.r-project.org/web/packages/sp/index.html, you would need to check if these packages are already in Azure ML: utils, stats, graphics, grDevices, methods, lattice, grid

    For the package: fields: https://cran.r-project.org/web/packages/fields/index.html, you would need to check if methods, spam, maps are installed in Azure ML.

    Pls check to see the dependency of each of these packages in the CRAN respository for the 'Depends' as well as 'Imports' section:

    To check for the packages already installed in Azure ML, pls use this script:

    data <- data.frame(installed.packages())
    # Select data.frame to be sent to the output Dataset port
    maml.mapOutputPort("data");

    Another aspect you need to consider is the version of R that is needed for this package. To check the version of R that is pre-installed in Azure ML use this script:

    print(version)

    Thanks,
    Jaya.




    Monday, December 14, 2015 3:50 PM
  • Hi Jaya!

    I had your same issue.

    Unfortunately (or fortunately!!) it is not a problem of your code. It is a bug that Azure is trying to solve. Look here at the end of the comments.

    Thursday, July 21, 2016 10:17 AM

All replies

  • Hi Hanieh,

    I suspect this has something to do with the dependencies for the package (rworldmap).

    For the package (rworldmap) https://cran.r-project.org/web/packages/rworldmap/index.html, you would need packages: sp, maptools, fields.

    Now maptools is pre-installed in Azure ML, but fields and sp need to be installed.

    For the package: sp: https://cran.r-project.org/web/packages/sp/index.html, you would need to check if these packages are already in Azure ML: utils, stats, graphics, grDevices, methods, lattice, grid

    For the package: fields: https://cran.r-project.org/web/packages/fields/index.html, you would need to check if methods, spam, maps are installed in Azure ML.

    Pls check to see the dependency of each of these packages in the CRAN respository for the 'Depends' as well as 'Imports' section:

    To check for the packages already installed in Azure ML, pls use this script:

    data <- data.frame(installed.packages())
    # Select data.frame to be sent to the output Dataset port
    maml.mapOutputPort("data");

    Another aspect you need to consider is the version of R that is needed for this package. To check the version of R that is pre-installed in Azure ML use this script:

    print(version)

    Thanks,
    Jaya.




    Monday, December 14, 2015 3:50 PM
  • Hello!

    This part of Azure is really tricky, download and move all the dependency packages in a new folder, zip it and import in Azure. But before that be sure all the packages work in 3.1.0 version of R or older. because currently Azure is using this version, so any latest version will not work.

    BR,

    Bipul

    Wednesday, January 20, 2016 1:24 PM
  • Hi Jaya!

    I had your same issue.

    Unfortunately (or fortunately!!) it is not a problem of your code. It is a bug that Azure is trying to solve. Look here at the end of the comments.

    Thursday, July 21, 2016 10:17 AM
  • Thank you for updating the thread! This will help other users if they encounter the issue.
    Thursday, July 21, 2016 2:07 PM
  • I also noticed that you have to remove the version number from the CRAN zip file to work, you cannot directly use the CRAN zip file as a bundle source.

    Take the rworldmap.zip as an example:

    First you download the windows binary zip rworldmap_1.3-6.zip.

    Rename the zip from rworldmap_1.3-6.zip to rworldmap.zip.

    Then compress rworldmap.zip (along with other missing dependencies) to something like R_packages.zip.

    Upload R_packages.zip to Azure ML and link it as a R bundle (similar connection to what you see in diagram from first post) 

    Then use these commands in the R Script:

    install.packages("src/R_packages.zip", lib = ".", repos = NULL, verbose = TRUE) 
    library("rworldmap", lib.loc = ".", verbose = TRUE)

    This works for me.

    Tuesday, July 26, 2016 1:55 AM
  • Thanks for your reply, your suggestion will most certainly help other users!
    Tuesday, July 26, 2016 2:17 PM