Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating packages via R-update-package is brocken #58

Open
paulkitt opened this issue Apr 2, 2024 · 9 comments
Open

Updating packages via R-update-package is brocken #58

paulkitt opened this issue Apr 2, 2024 · 9 comments

Comments

@paulkitt
Copy link

paulkitt commented Apr 2, 2024

When updating packages via the role the 'R-update-package' results in this error:

failed: [... (item={'name': 'psych', 'type': 'cran', 'state': 'updated'}) => changed=false 
  ansible_loop_var: item
  cmd:
  - /usr/local/bin/R-update-package
  - psych
  - cran
  - /usr/local/lib/R/site-library
  delta: '0:00:01.354098'
  end: '2024-04-02 11:24:04.696954'
  item:
    name: psych
    state: updated
    type: cran
  msg: non-zero return code
  rc: 1
  start: '2024-04-02 11:24:03.342856'
  stderr: |-
    Error in download.file(url = paste0(repos, "/PACKAGES.rds"), destfile = dest,  :
      downloaded length 0 != reported length 0
    Calls: withCallingHandlers ... tryCatchList -> tryCatchOne -> doTryCatch -> download.file
    Execution halted
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

I tried to use the R update script directly resulting in the same problem:

./R-update-package psych cran /usr/local/lib/R/site-library 
Error in download.file(url = paste0(repos, "/PACKAGES.rds"), destfile = dest,  : 
  downloaded length 0 != reported length 0
Calls: withCallingHandlers ... tryCatchList -> tryCatchOne -> doTryCatch -> download.file
Execution halted
@paulkitt
Copy link
Author

paulkitt commented Apr 2, 2024

I tried to figure out how to fix the script but failed with lacking the knowledge about R and RScript.
Would be amazing if anybody could write a fix/submit a mr. Its a great role and we are happy that we found it.

@tersmitten
Copy link
Member

I'll have a look when I find some time. What's the OS / version you are using?

@paulkitt
Copy link
Author

Amazing thanks a lot! We are deploying the role to Ubuntu 22.04

@tersmitten
Copy link
Member

Can you attach te "configuration" you're using? Otherwise it is a bit difficult to replicate your results :-)

@paulkitt
Copy link
Author

Yes sure. I replicated the problem inside the molecule test:

  1. Update molecule converge and run molecule
---
- name: Converge
  hosts: all
  become: true
  vars:
    r_packages:
      - name: yaml
        state: updated
  roles:
    - ../../../
  1. Install older version of cran pkt
molecule login
R
packageurl <- "https://cran.r-project.org/src/contrib/Archive/yaml/yaml_2.3.7.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
  1. Run Molecule again to update the pkt

Error:

TASK [../../../ : packages | update] *******************************************
failed: [instance] (item={'name': 'yaml', 'state': 'updated'}) => {"ansible_loop_var": "item", "changed": false, "cmd": ["/usr/local/bin/R-update-package", "yaml", "cran", "/usr/local/lib/R/site-library"], "delta": "0:00:02.106649", "end": "2024-04-11 12:58:32.121181", "item": {"name": "yaml", "state": "updated"}, "msg": "non-zero return code", "rc": 1, "start": "2024-04-11 12:58:30.014532", "stderr": "Error in download.file(url = paste0(repos, \"/PACKAGES.rds\"), destfile = dest,  : \n  cannot open URL 'https://cran.rstudio.com/PACKAGES.rds': HTTP status was '404 Not Found'\nCalls: withCallingHandlers ... tryCatchList -> tryCatchOne -> doTryCatch -> download.file\nExecution halted", "stderr_lines": ["Error in download.file(url = paste0(repos, \"/PACKAGES.rds\"), destfile = dest,  : ", "  cannot open URL 'https://cran.rstudio.com/PACKAGES.rds': HTTP status was '404 Not Found'", "Calls: withCallingHandlers ... tryCatchList -> tryCatchOne -> doTryCatch -> download.file", "Execution halted"], "stdout": "", "stdout_lines": []}

@tersmitten
Copy link
Member

The output already reveals the issue:

cannot open URL 'https://cran.rstudio.com/PACKAGES.rds': HTTP status was '404 Not Found'

@tersmitten
Copy link
Member

Can you try configuring it like this?

---
- name: Converge
  hosts: all
  become: true
  vars:
    r_cran_mirror: https://cloud.r-project.org/
    r_packages:
      - name: yaml
        state: updated
  roles:
    - ../../../

@paulkitt
Copy link
Author

paulkitt commented Apr 18, 2024

Changing the r_cran_mirror results in the same problem:

failed: [instance] (item={'name': 'yaml', 'state': 'updated'}) => {"ansible_loop_var": "item", "changed": false, "cmd": ["/usr/local/bin/R-update-package", "yaml", "cran", "/usr/local/lib/R/site-library"], "delta": "0:00:01.149067", "end": "2024-04-18 13:16:36.394198", "item": {"name": "yaml", "state": "updated"}, "msg": "non-zero return code", "rc": 1, "start": "2024-04-18 13:16:35.245131", "stderr": "Error in download.file(url = paste0(repos, \"/PACKAGES.rds\"), destfile = dest,  : \n  cannot open URL 'https://cloud.r-project.org/PACKAGES.rds': HTTP status was '404 Not Found'\nCalls: withCallingHandlers ... tryCatchList -> tryCatchOne -> doTryCatch -> download.file\nExecution halted", "stderr_lines": ["Error in download.file(url = paste0(repos, \"/PACKAGES.rds\"), destfile = dest,  : ", "  cannot open URL 'https://cloud.r-project.org/PACKAGES.rds': HTTP status was '404 Not Found'", "Calls: withCallingHandlers ... tryCatchList -> tryCatchOne -> doTryCatch -> download.file", "Execution halted"], "stdout": "", "stdout_lines": []}

I tried to make sense of the R-update-package r-script but didnt understand why there this url is called and why it is brocken. I really like the approach to install the packages directly via R and via apt. Would be great to find a fix.

@paulkitt
Copy link
Author

Are the Rscripts included in the role part of a lager project where I could ask for support to fix the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants