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

xfun-0.40 fails to build under Windows #530

Closed
5 tasks done
ns-rse opened this issue Nov 16, 2023 · 3 comments
Closed
5 tasks done

xfun-0.40 fails to build under Windows #530

ns-rse opened this issue Nov 16, 2023 · 3 comments

Comments

@ns-rse
Copy link

ns-rse commented Nov 16, 2023

Before filing a bug

  • I have installed the latest dev version of {precommit} with remotes::install_github('lorenzwalthert/precommit')
  • I have installed the latest hook revisions (update with precommit::autoupdate())
  • I have installed the latest release of the upstream Python framework pre-commit as described under the update instructions.

Describe the bug

I'm trying to install and use precommit under Windows but find that the environment that precommit downloads wishes to requires xfun-0.40 that it should be downloaded from RSPM unfortunately this is one package for which binaries have not yet been built (see xfun overview | Package Manager).

The latest version available on CRAN is xfun-0.41 and there are Windows binaries available for that version.

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/ns-rse/thyroid-cancer-prediction/
  2. renv::restore()
  3. install.packages(c("remotes", "reticulate"))
  4. remotes::install_github("lorenzwalthert/precommit")
  5. options(timeout=600)
  6. reticulate::install_miniconda()
  7. precommit::install_precommit()
  8. precommit::autoupdate()
  9. precommit::use_precommit(install_hooks = TRUE)
  10. Make a new branch and commit the changes (should be bumping hook versions for precommit and markdownlint-cli2.

Expected behavior

A clear and concise description of what you expected to happen.

Additional context

  • My operating system is: Windows11
  • My project uses {renv}.
  • the output of packageVersion('renv') : [1] '1.0.3'

I have xfun-0.41 from CRAN defined in my projects renv.lock but the issue is within the environment, and I think but am not sure that its precommit that requires xfun-0.40 as defined in the renv.lock. Not sure but would bumping the version and changing the repository to CRAN solve this? Happy to make a PR if so but I don't feel I have a good/correct understanding of the root cause.

NB No such issues under GNU/Linux, a colleague I'm helping uses Windows though so I need them setup with precommit (shortens the feedback loop rather than waiting on pre-commit.ci). I've repeated all these steps under a Windows11 VM.

version information

pre-commit version: 3.4.0
git --version: git version 2.41.0.windows.3
sys.version:
    3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:28:38) [MSC v.1929 64 bit (AMD64)]
sys.executable: C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\python.exe
os.name: nt
sys.platform: win32

error information

An unexpected error has occurred: CalledProcessError: command: ('C:/PROGRA~1/R/R-43~1.1\\bin\\Rscript.exe', '--vanilla', 'C:\\Users\\nshep\\AppData\\Local\\Temp\\tmp_72nkfjw\\script.R')
return code: 1
stdout:
    * Querying repositories for available binary packages ... Done!
    * Querying repositories for available source packages ... Done!
    Retrieving 'https://packagemanager.rstudio.com/all/latest/src/contrib/Archive/xfun/xfun_0.40.tar.gz' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/hunspell_3.0.3.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/src/contrib/Archive/knitr/knitr_1.44.tar.gz' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/src/contrib/Archive/lintr/lintr_3.1.0.tar.gz' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/pkgbuild_1.4.2.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/prettyunits_1.2.0.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/pkgload_1.3.3.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/purrr_1.0.2.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/vctrs_0.6.4.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/styler_1.10.2.zip' ...
    	OK [file is up to date]
    Installing R.methodsS3 [1.8.2] ...
    	OK [linked cache in 3.1 milliseconds]
    Installing R.oo [1.25.0] ...
    	OK [linked cache in 3.5 milliseconds]
    Installing R.utils [2.12.2] ...
    	OK [linked cache in 3.8 milliseconds]
    Installing digest [0.6.33] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing R.cache [0.16.0] ...
    	OK [linked cache in 2.1 milliseconds]
    Installing R6 [2.5.1] ...
    	OK [linked cache in 1.6 milliseconds]
    Installing Rcpp [1.0.11] ...
    	OK [linked cache in 2.8 milliseconds]
    Installing backports [1.4.1] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing brew [1.0-8] ...
    	OK [linked cache in 1.6 milliseconds]
    Installing ps [1.7.5] ...
    	OK [linked cache in 2.3 milliseconds]
    Installing processx [3.8.2] ...
    	OK [linked cache in 2.5 milliseconds]
    Installing callr [3.7.3] ...
    	OK [linked cache in 1.4 milliseconds]
    Installing cli [3.6.1] ...
    	OK [linked cache in 1.5 milliseconds]
    Installing commonmark [1.9.0] ...
    	OK [linked cache in 8 milliseconds]
    Installing cpp11 [0.4.6] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing crayon [1.5.2] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing rprojroot [2.0.3] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing desc [1.4.2] ...
    	OK [linked cache in 3.4 milliseconds]
    Installing remotes [2.4.2.1] ...
    	OK [linked cache in 1.4 milliseconds]
    Installing withr [2.5.1] ...
    	OK [linked cache in 2.3 milliseconds]
    Installing cyclocomp [1.1.1] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing docopt [0.7.1] ...
    	OK [linked cache in 2.3 milliseconds]
    Installing evaluate [0.22] ...
    	OK [linked cache in 1.6 milliseconds]
    Installing fs [1.6.3] ...
    	OK [linked cache in 2 milliseconds]
    Installing glue [1.6.2] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing here [1.0.1] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing xfun [0.40] ...
    	FAILED
    Error installing package 'xfun':
    ================================
    
    * installing *source* package 'xfun' ...
    ** package 'xfun' successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    Error in system(paste(MAKE, p1(paste("-f", shQuote(makefiles))), "compilers"),  : 
      'make' not found
    * removing 'C:/Users/nshep/.cache/pre-commit/repod47ku_h9/renv-default/renv/staging/1/xfun'
stderr:
    # Bootstrapping renv 1.0.3 --------------------------------------------------
    * Downloading renv 1.0.3 ... OK
    * Installing renv 1.0.3 ... Done!
    * Successfully installed and loaded renv 1.0.3.
    The following package(s) will be updated:
    
    # RSPM ===============================
    - R.cache        [* -> 0.16.0]
    - R.methodsS3    [* -> 1.8.2]
    - R.oo           [* -> 1.25.0]
    - R.utils        [* -> 2.12.2]
    - R6             [* -> 2.5.1]
    - Rcpp           [* -> 1.0.11]
    - backports      [* -> 1.4.1]
    - brew           [* -> 1.0-8]
    - callr          [* -> 3.7.3]
    - cli            [* -> 3.6.1]
    - commonmark     [* -> 1.9.0]
    - cpp11          [* -> 0.4.6]
    - crayon         [* -> 1.5.2]
    - cyclocomp      [* -> 1.1.1]
    - desc           [* -> 1.4.2]
    - digest         [* -> 0.6.33]
    - docopt         [* -> 0.7.1]
    - evaluate       [* -> 0.22]
    - fs             [* -> 1.6.3]
    - glue           [* -> 1.6.2]
    - here           [* -> 1.0.1]
    - highr          [* -> 0.10]
    - hunspell       [* -> 3.0.3]
    - knitr          [* -> 1.44]
    - lazyeval       [* -> 0.2.2]
    - lifecycle      [* -> 1.0.3]
    - lintr          [* -> 3.1.0]
    - magrittr       [* -> 2.0.3]
    - pkgbuild       [* -> 1.4.2]
    - pkgload        [* -> 1.3.3]
    - prettyunits    [* -> 1.2.0]
    - processx       [* -> 3.8.2]
    - ps             [* -> 1.7.5]
    - purrr          [* -> 1.0.2]
    - remotes        [* -> 2.4.2.1]
    - rex            [* -> 1.2.1]
    - rlang          [* -> 1.1.1]
    - roxygen2       [* -> 7.2.3]
    - rprojroot      [* -> 2.0.3]
    - spelling       [* -> 2.2.1]
    - stringi        [* -> 1.7.12]
    - stringr        [* -> 1.5.0]
    - styler         [* -> 1.10.2]
    - vctrs          [* -> 0.6.4]
    - withr          [* -> 2.5.1]
    - xfun           [* -> 0.40]
    - xml2           [* -> 1.3.5]
    - xmlparsedata   [* -> 1.0.5]
    - yaml           [* -> 2.3.7]
    
    Error: install of package 'xfun' failed [error code 1]
    Traceback (most recent calls last):
    12: renv::restore()
    11: renv_restore_run_actions(project, diff, current, lockfile, rebuild)
    10: renv_install_impl(records)
     9: renv_install_staged(records)
     8: renv_install_default(records)
     7: handler(package, renv_install_package(record))
     6: renv_install_package(record)
     5: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
            vwritef("\tFAILED")
            writef(e$output)
        })
     4: renv_install_package_impl(record)
     3: r_cmd_install(package, path)
     2: r_exec_error(package, output, "install", status)
     1: stop(error)
    Execution halted
Traceback (most recent call last):
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\error_handler.py", line 73, in error_handler
    yield
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\main.py", line 386, in main
    return hook_impl(
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\commands\hook_impl.py", line 271, in hook_impl
    return retv | run(config, store, ns)
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\commands\run.py", line 442, in run
    install_hook_envs(to_install, store)
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\repository.py", line 248, in install_hook_envs
    _hook_install(hook)
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\repository.py", line 95, in _hook_install
    lang.install_environment(
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\languages\r.py", line 148, in install_environment
    cmd_output_b(_rscript_exec(), '--vanilla', f, cwd=env_dir)
  File "C:\Users\nshep\AppData\Local\r-miniconda\envs\r-precommit\lib\site-packages\pre_commit\util.py", line 110, in cmd_output_b
    raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('C:/PROGRA~1/R/R-43~1.1\\bin\\Rscript.exe', '--vanilla', 'C:\\Users\\nshep\\AppData\\Local\\Temp\\tmp_72nkfjw\\script.R')
return code: 1
stdout:
    * Querying repositories for available binary packages ... Done!
    * Querying repositories for available source packages ... Done!
    Retrieving 'https://packagemanager.rstudio.com/all/latest/src/contrib/Archive/xfun/xfun_0.40.tar.gz' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/hunspell_3.0.3.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/src/contrib/Archive/knitr/knitr_1.44.tar.gz' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/src/contrib/Archive/lintr/lintr_3.1.0.tar.gz' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/pkgbuild_1.4.2.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/prettyunits_1.2.0.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/pkgload_1.3.3.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/purrr_1.0.2.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/vctrs_0.6.4.zip' ...
    	OK [file is up to date]
    Retrieving 'https://packagemanager.rstudio.com/all/latest/bin/windows/contrib/4.3/styler_1.10.2.zip' ...
    	OK [file is up to date]
    Installing R.methodsS3 [1.8.2] ...
    	OK [linked cache in 3.1 milliseconds]
    Installing R.oo [1.25.0] ...
    	OK [linked cache in 3.5 milliseconds]
    Installing R.utils [2.12.2] ...
    	OK [linked cache in 3.8 milliseconds]
    Installing digest [0.6.33] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing R.cache [0.16.0] ...
    	OK [linked cache in 2.1 milliseconds]
    Installing R6 [2.5.1] ...
    	OK [linked cache in 1.6 milliseconds]
    Installing Rcpp [1.0.11] ...
    	OK [linked cache in 2.8 milliseconds]
    Installing backports [1.4.1] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing brew [1.0-8] ...
    	OK [linked cache in 1.6 milliseconds]
    Installing ps [1.7.5] ...
    	OK [linked cache in 2.3 milliseconds]
    Installing processx [3.8.2] ...
    	OK [linked cache in 2.5 milliseconds]
    Installing callr [3.7.3] ...
    	OK [linked cache in 1.4 milliseconds]
    Installing cli [3.6.1] ...
    	OK [linked cache in 1.5 milliseconds]
    Installing commonmark [1.9.0] ...
    	OK [linked cache in 8 milliseconds]
    Installing cpp11 [0.4.6] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing crayon [1.5.2] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing rprojroot [2.0.3] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing desc [1.4.2] ...
    	OK [linked cache in 3.4 milliseconds]
    Installing remotes [2.4.2.1] ...
    	OK [linked cache in 1.4 milliseconds]
    Installing withr [2.5.1] ...
    	OK [linked cache in 2.3 milliseconds]
    Installing cyclocomp [1.1.1] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing docopt [0.7.1] ...
    	OK [linked cache in 2.3 milliseconds]
    Installing evaluate [0.22] ...
    	OK [linked cache in 1.6 milliseconds]
    Installing fs [1.6.3] ...
    	OK [linked cache in 2 milliseconds]
    Installing glue [1.6.2] ...
    	OK [linked cache in 1.8 milliseconds]
    Installing here [1.0.1] ...
    	OK [linked cache in 1.7 milliseconds]
    Installing xfun [0.40] ...
    	FAILED
    Error installing package 'xfun':
    ================================
    
    * installing *source* package 'xfun' ...
    ** package 'xfun' successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    Error in system(paste(MAKE, p1(paste("-f", shQuote(makefiles))), "compilers"),  : 
      'make' not found
    * removing 'C:/Users/nshep/.cache/pre-commit/repod47ku_h9/renv-default/renv/staging/1/xfun'
stderr:
    # Bootstrapping renv 1.0.3 --------------------------------------------------
    * Downloading renv 1.0.3 ... OK
    * Installing renv 1.0.3 ... Done!
    * Successfully installed and loaded renv 1.0.3.
    The following package(s) will be updated:
    
    # RSPM ===============================
    - R.cache        [* -> 0.16.0]
    - R.methodsS3    [* -> 1.8.2]
    - R.oo           [* -> 1.25.0]
    - R.utils        [* -> 2.12.2]
    - R6             [* -> 2.5.1]
    - Rcpp           [* -> 1.0.11]
    - backports      [* -> 1.4.1]
    - brew           [* -> 1.0-8]
    - callr          [* -> 3.7.3]
    - cli            [* -> 3.6.1]
    - commonmark     [* -> 1.9.0]
    - cpp11          [* -> 0.4.6]
    - crayon         [* -> 1.5.2]
    - cyclocomp      [* -> 1.1.1]
    - desc           [* -> 1.4.2]
    - digest         [* -> 0.6.33]
    - docopt         [* -> 0.7.1]
    - evaluate       [* -> 0.22]
    - fs             [* -> 1.6.3]
    - glue           [* -> 1.6.2]
    - here           [* -> 1.0.1]
    - highr          [* -> 0.10]
    - hunspell       [* -> 3.0.3]
    - knitr          [* -> 1.44]
    - lazyeval       [* -> 0.2.2]
    - lifecycle      [* -> 1.0.3]
    - lintr          [* -> 3.1.0]
    - magrittr       [* -> 2.0.3]
    - pkgbuild       [* -> 1.4.2]
    - pkgload        [* -> 1.3.3]
    - prettyunits    [* -> 1.2.0]
    - processx       [* -> 3.8.2]
    - ps             [* -> 1.7.5]
    - purrr          [* -> 1.0.2]
    - remotes        [* -> 2.4.2.1]
    - rex            [* -> 1.2.1]
    - rlang          [* -> 1.1.1]
    - roxygen2       [* -> 7.2.3]
    - rprojroot      [* -> 2.0.3]
    - spelling       [* -> 2.2.1]
    - stringi        [* -> 1.7.12]
    - stringr        [* -> 1.5.0]
    - styler         [* -> 1.10.2]
    - vctrs          [* -> 0.6.4]
    - withr          [* -> 2.5.1]
    - xfun           [* -> 0.40]
    - xml2           [* -> 1.3.5]
    - xmlparsedata   [* -> 1.0.5]
    - yaml           [* -> 2.3.7]
    
    Error: install of package 'xfun' failed [error code 1]
    Traceback (most recent calls last):
    12: renv::restore()
    11: renv_restore_run_actions(project, diff, current, lockfile, rebuild)
    10: renv_install_impl(records)
     9: renv_install_staged(records)
     8: renv_install_default(records)
     7: handler(package, renv_install_package(record))
     6: renv_install_package(record)
     5: withCallingHandlers(renv_install_package_impl(record), error = function(e) {
            vwritef("\tFAILED")
            writef(e$output)
        })
     4: renv_install_package_impl(record)
     3: r_cmd_install(package, path)
     2: r_exec_error(package, output, "install", status)
     1: stop(error)
    Execution halted

EDIT : realised I'd copied an old version of the log which used renv-0.17.3 I still see the same error with renv-1.0.3, updated above pre-commit.log to reflect this.

@lorenzwalthert
Copy link
Owner

First of all, thanks for the great description. A reproducible example would not have been necessary for such a (trivial) case. Automatic hook updates are running, such as #527, but I did not want to merge now since {stringr} was apparently not available as a binary yet from RSPM and the build process I set up decided instead to switch to CRAN, which I don't want, since I was not sure it would be a problem that there are no linux binaries available (but now I actually think it would not matter since the package does not need compilation, only the {stringi} dependency is problematic. Anyways, the last force push has resolved the issue in #527 and so we can merge this. Afterwards, I can create a new hook release that you can use.

@lorenzwalthert
Copy link
Owner

lorenzwalthert commented Nov 16, 2023

Done @ns-rse, can you run autoupdate and try again? Also, I described the problem in RStudio Community. Let's see if they have it on the roadmap to keep old binaries.

@ns-rse
Copy link
Author

ns-rse commented Nov 17, 2023

Thank you so much for the quick fix @lorenzwalthert really appreciate it. 👍

Ran precommit::autoupdate() and its bumped to v0.3.2.9027, made a commit and the hooks all ran ok this time.

I came across this blog on Posit just the other day which gives some insight into what binaries they are building The Road to Building Ten Million Binaries - Posit, although I see there is already a reply indicating where older snapshots can be found. Doesn't sound like it would be very easy to use the older snapshots, but its not an uncommon issue and is on their roadmap.

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