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

Distill template can't be rendered on Mac #207

Closed
relund opened this issue Oct 29, 2020 · 14 comments
Closed

Distill template can't be rendered on Mac #207

relund opened this issue Oct 29, 2020 · 14 comments

Comments

@relund
Copy link

relund commented Oct 29, 2020

Trying to knit the template

---
title: "Untitled"
description: |
  A new article created using the Distill format.
author:
  - name: Nora Jones 
    url: https://example.com/norajones
    affiliation: Spacely Sprockets
    affiliation_url: https://example.com/spacelysprokets
date: "`r Sys.Date()`"
output: distill::distill_article
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

Distill is a publication format for scientific and technical writing, native to the web. 

Learn more about using Distill for R Markdown at <https://rstudio.github.io/distill>.

Gives error

Error in C_force_tz(time, tz = tzone, roll) : 
  CCTZ: Unrecognized output timezone: "Europe/Copenhagen"
Calls: <Anonymous> ... .parse_date_time -> .strptime -> force_tz -> C_force_tz
Execution halted

Any hints on how to fix?

SessionInfo

> devtools::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.3 (2020-10-10)
 os       macOS Catalina 10.15.7      
 system   x86_64, darwin19.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Copenhagen           
 date     2020-10-29                  

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source                     
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.3)             
 backports     1.1.10  2020-09-15 [1] CRAN (R 4.0.3)             
 callr         3.5.1   2020-10-13 [1] CRAN (R 4.0.3)             
 cli           2.1.0   2020-10-12 [1] CRAN (R 4.0.3)             
 crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.3)             
 desc          1.2.0   2018-05-01 [1] github (r-lib/desc@ec81430)
 devtools      2.3.2   2020-09-18 [1] CRAN (R 4.0.3)             
 digest        0.6.27  2020-10-24 [1] CRAN (R 4.0.3)             
 distill       1.0     2020-10-22 [1] CRAN (R 4.0.3)             
 downlit       0.2.0   2020-09-25 [1] CRAN (R 4.0.3)             
 ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.3)             
 evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.3)             
 fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.3)             
 fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.3)             
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.3)             
 htmltools     0.5.0   2020-06-16 [1] CRAN (R 4.0.3)             
 knitr         1.30    2020-09-22 [1] CRAN (R 4.0.3)             
 magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.3)             
 memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.3)             
 pkgbuild      1.1.0   2020-07-13 [1] CRAN (R 4.0.3)             
 pkgload       1.1.0   2020-05-29 [1] CRAN (R 4.0.3)             
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.3)             
 processx      3.4.4   2020-09-03 [1] CRAN (R 4.0.3)             
 ps            1.4.0   2020-10-07 [1] CRAN (R 4.0.3)             
 R6            2.4.1   2019-11-12 [1] CRAN (R 4.0.3)             
 remotes       2.2.0   2020-07-21 [1] CRAN (R 4.0.3)             
 rlang         0.4.8   2020-10-08 [1] CRAN (R 4.0.3)             
 rmarkdown     2.5     2020-10-21 [1] CRAN (R 4.0.3)             
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.3)             
 rstudioapi    0.11    2020-02-07 [1] CRAN (R 4.0.3)             
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.3)             
 testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.3)             
 usethis       1.6.3   2020-09-17 [1] CRAN (R 4.0.3)             
 withr         2.3.0   2020-09-22 [1] CRAN (R 4.0.3)             
 xfun          0.18    2020-09-29 [1] CRAN (R 4.0.3)             
 yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.3)             

[1] /usr/local/lib/R/4.0/site-library
[2] /usr/local/Cellar/r/4.0.3/lib/R/library
```
@csdaw
Copy link

csdaw commented Oct 30, 2020

I'm having the same issue since I last built my blog 4 days ago. It seems to be a problem just with distill blogs rather than distill websites as generating a brand new distill website project works fine but a distill blog fails with the same timezone error.

Things I've tried which haven't worked:

  • Reinstall RStudio (I'm on version 1.4 preview)
  • Reinstall distill from CRAN
  • Reinstall distill from GitHub (HEAD and an older commit)

Here is the error:

Error in C_force_tz(time, tz = tzone, roll) : 
  CCTZ: Unrecognized output timezone: "Europe/London"

And here is my devtools::session_info():

─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.3 (2020-10-10)
 os       macOS Catalina 10.15.7      
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_AU.UTF-8                 
 ctype    en_AU.UTF-8                 
 tz       Europe/London               
 date     2020-10-30                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.0)
 backports     1.1.10  2020-09-15 [1] CRAN (R 4.0.2)
 callr         3.5.1   2020-10-13 [1] CRAN (R 4.0.2)
 cli           2.1.0   2020-10-12 [1] CRAN (R 4.0.2)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.0)
 desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.0)
 devtools      2.3.2   2020-09-18 [1] CRAN (R 4.0.2)
 digest        0.6.27  2020-10-24 [1] CRAN (R 4.0.2)
 distill       1.0     2020-10-22 [1] CRAN (R 4.0.3)
 downlit       0.2.0   2020-09-25 [1] CRAN (R 4.0.2)
 ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.0)
 evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.0)
 fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.0)
 fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.2)
 generics      0.0.2   2018-11-29 [1] CRAN (R 4.0.0)
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.2)
 htmltools     0.5.0   2020-06-16 [1] CRAN (R 4.0.0)
 knitr         1.30    2020-09-22 [1] CRAN (R 4.0.2)
 lubridate     1.7.9   2020-06-08 [1] CRAN (R 4.0.2)
 magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.0)
 memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.0)
 pkgbuild      1.1.0   2020-07-13 [1] CRAN (R 4.0.2)
 pkgload       1.1.0   2020-05-29 [1] CRAN (R 4.0.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.0)
 processx      3.4.4   2020-09-03 [1] CRAN (R 4.0.2)
 ps            1.4.0   2020-10-07 [1] CRAN (R 4.0.2)
 R6            2.5.0   2020-10-28 [1] CRAN (R 4.0.3)
 Rcpp          1.0.5   2020-07-06 [1] CRAN (R 4.0.0)
 remotes       2.2.0   2020-07-21 [1] CRAN (R 4.0.2)
 rlang         0.4.8   2020-10-08 [1] CRAN (R 4.0.2)
 rmarkdown     2.5     2020-10-21 [1] CRAN (R 4.0.3)
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.0)
 rstudioapi    0.11    2020-02-07 [1] CRAN (R 4.0.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.0)
 stringi       1.5.3   2020-09-09 [1] CRAN (R 4.0.2)
 stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.0)
 testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.0)
 usethis       1.6.3   2020-09-17 [1] CRAN (R 4.0.2)
 whisker       0.4     2019-08-28 [1] CRAN (R 4.0.0)
 withr         2.3.0   2020-09-22 [1] CRAN (R 4.0.2)
 xfun          0.18    2020-09-29 [1] CRAN (R 4.0.2)
 yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.0)

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

@jjallaire
Copy link
Member

This may have been a change we made in the last release to emit locale independent RSS feeds for blogs. I've reverted that change here: c9c083b.

Could you try again installing from GitHub?

@csdaw
Copy link

csdaw commented Oct 30, 2020

I installed from c9c083b but I'm still getting the same error.

Going down the debugger rabbit hole I can see the error is coming from this line in distill:::parse_date():

parsed_date <- lubridate::mdy("10-30-2020", tz = distill:::safe_timezone(), quiet = TRUE)

Not sure how to fix it though.

@jjallaire
Copy link
Member

@csdaw What is the output of OlsonNames() on your system?

@vspinu Here is the code we are executing:

tz <- Sys.timezone()
tz <- ifelse(is.na(tz), "UTC", tz)
lubridate::mdy("12/22/22", tz = tz, quiet = TRUE)

What condition would cause lubridate to throw this error?

Error in C_force_tz(time, tz = tzone, roll) : 
  CCTZ: Unrecognized output timezone: "Europe/London"

Is there a workaround you know of to ensure we don't halt when this occurs?

@csdaw
Copy link

csdaw commented Oct 30, 2020

I think I've solved the cause, its a bug with R v4.0.3.

I have access to another Mac with R v4.0.2 and distill blog posts render fine with no errors. And then just now when I upgrade to R v.4.0.3 the timezone error is produced.

Here is my dev tools::session_info() prior to upgrading:

─ Session info ──────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       macOS Catalina 10.15.7      
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_AU.UTF-8                 
 ctype    en_AU.UTF-8                 
 tz       Europe/London               
 date     2020-10-30                  

─ Packages ──────────────────────────────────────────────────────────
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.0)
 backports     1.1.10  2020-09-15 [1] CRAN (R 4.0.2)
 callr         3.4.4   2020-09-07 [1] CRAN (R 4.0.2)
 cli           2.0.2   2020-02-28 [1] CRAN (R 4.0.0)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.0)
 desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.0)
 devtools      2.3.2   2020-09-18 [1] CRAN (R 4.0.2)
 digest        0.6.25  2020-02-23 [1] CRAN (R 4.0.0)
 distill       1.0     2020-10-22 [1] CRAN (R 4.0.2)
 downlit       0.2.0   2020-09-25 [1] CRAN (R 4.0.2)
 ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.0)
 evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.0)
 fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.0)
 fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.2)
 glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.2)
 htmltools     0.5.0   2020-06-16 [1] CRAN (R 4.0.0)
 knitr         1.30    2020-09-22 [1] CRAN (R 4.0.2)
 magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.0)
 memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.0)
 pkgbuild      1.1.0   2020-07-13 [1] CRAN (R 4.0.2)
 pkgload       1.1.0   2020-05-29 [1] CRAN (R 4.0.0)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.0)
 processx      3.4.4   2020-09-03 [1] CRAN (R 4.0.2)
 ps            1.3.4   2020-08-11 [1] CRAN (R 4.0.2)
 R6            2.4.1   2019-11-12 [1] CRAN (R 4.0.0)
 remotes       2.2.0   2020-07-21 [1] CRAN (R 4.0.2)
 rlang         0.4.7   2020-07-09 [1] CRAN (R 4.0.2)
 rmarkdown     2.5     2020-10-21 [1] CRAN (R 4.0.2)
 rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.0)
 rstudioapi    0.11    2020-02-07 [1] CRAN (R 4.0.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.0)
 testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.0)
 usethis       1.6.3   2020-09-17 [1] CRAN (R 4.0.2)
 withr         2.3.0   2020-09-22 [1] CRAN (R 4.0.2)
 xfun          0.18    2020-09-29 [1] CRAN (R 4.0.2)
 yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.0)

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

I can give you the OlsonNames() output when I am back at home.

@jjallaire
Copy link
Member

Sure enough there were timezone related changes in R 4.0.3, from NEWS:

On platforms using configure option --with-internal-tzcode, additional values "internal"
and (on macOS only) "macOS" are accepted for the environment variable TZDIR. (See ?TZDIR.)

On macOS, "macOS" is used by default if the system timezone database is a newer version
than that in the R installation.

@jjallaire
Copy link
Member

Also reported on the lubridate repo: tidyverse/lubridate#928

@jjallaire
Copy link
Member

@relund There are some things for you to try/investigate here: tidyverse/lubridate#928. Let us know what you find.

@jjallaire
Copy link
Member

This appears to be the result of a bug in R 4.0.3 related to setting the TZDIR environment variable (which downstream code expects to be a path). Temporary workaround until this is fixed is here: cdcbd56 (note: timezone will be forced to UTC for parsing dates when this workaround is in effect)

@jjallaire
Copy link
Member

jjallaire commented Nov 2, 2020 via email

@iamericfletcher
Copy link

@jjallaire

Everything is working fine now. I am able to knit, build, and push to GitHub with no errors.

Thank you!

@jjallaire
Copy link
Member

jjallaire commented Nov 2, 2020 via email

@vspinu
Copy link

vspinu commented Nov 2, 2020

This appears to be the result of a bug in R 4.0.3 related to setting the TZDIR environment variable (which downstream code expects to be a path).

@jjallaire Is this has been reported/confirmed as a bug in R?

@jjallaire
Copy link
Member

jjallaire commented Nov 2, 2020 via email

cderv added a commit that referenced this issue Feb 12, 2021
lubridate has now the fix for timezone on macOS. So the workaround for #207 is no more needed.
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

5 participants