-
Notifications
You must be signed in to change notification settings - Fork 207
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
Error: CCTZ: Unrecognized output timezone #1041
Comments
Your tzdir is not set correctly for some reason. On windows tzinfo database is shipped with R. See the output |
Hi @vspinu , Everything is working as it should today... I installed R 4.2.0 yesterday, maybe it need a system restart to work properly. |
I am having the same issue as reported above, except mine has not resolved with computer / software restarts. This error is prohibiting my from using {distill} under R 4.2.0. Any suggestions on how to resolve would be much appreciated! In my console, in fresh instance of R not within a project, I get a few errors:
and when I run the same in a reprex I get no errors: lubridate:::tzdir_get()
#> [1] "C:/PROGRA~1/R/R-42~1.0/share/zoneinfo"
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "America/New_York"
)
#> [1] "2020-01-01 01:00:00 EST"
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "UTC"
)
#> [1] "2020-01-01 01:00:00 UTC"
callr::r(function() lubridate::mdy("05/11/2022", tz ="America/New_York"))
#> [1] "2022-05-11 EDT"
lubridate:::tzdir_set()
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "America/New_York"
)
#> [1] "2020-01-01 01:00:00 EST"
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.0 (2022-04-22 ucrt)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.utf8
#> ctype English_United States.utf8
#> tz America/New_York
#> date 2022-05-12
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> brio 1.1.2 2021-04-23 [1] CRAN (R 4.1.1)
#> cachem 1.0.6 2021-08-19 [1] CRAN (R 4.1.1)
#> callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.1)
#> cli 3.2.0 2022-02-14 [1] CRAN (R 4.1.3)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.1)
#> desc 1.4.0 2021-09-28 [1] CRAN (R 4.1.1)
#> devtools 2.4.3 2021-11-30 [1] CRAN (R 4.1.3)
#> digest 0.6.28 2021-09-23 [1] CRAN (R 4.1.1)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.1)
#> evaluate 0.15 2022-02-18 [1] CRAN (R 4.1.3)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.1)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.1)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.2)
#> generics 0.1.1 2021-10-25 [1] CRAN (R 4.1.1)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.3)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.1)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1)
#> knitr 1.38 2022-03-25 [1] CRAN (R 4.1.3)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1)
#> lubridate 1.8.0 2021-10-07 [1] CRAN (R 4.1.1)
#> magrittr 2.0.2 2022-01-26 [1] CRAN (R 4.1.3)
#> memoise 2.0.0 2021-01-26 [1] CRAN (R 4.1.1)
#> pillar 1.6.4 2021-10-18 [1] CRAN (R 4.1.1)
#> pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.1.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.1)
#> pkgload 1.2.3 2021-10-13 [1] CRAN (R 4.1.1)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.1)
#> processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.1)
#> ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.1)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.1)
#> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.1.3)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.1.1)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.1.1)
#> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.1.3)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.1)
#> remotes 2.4.1 2021-09-29 [1] CRAN (R 4.1.1)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.1)
#> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.3)
#> rmarkdown 2.11 2021-09-14 [1] CRAN (R 4.1.1)
#> rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.1.1)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.1)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.1)
#> stringi 1.7.5 2021-10-04 [1] CRAN (R 4.1.1)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.1)
#> styler 1.7.0 2022-03-13 [1] CRAN (R 4.1.3)
#> testthat 3.1.3 2022-03-29 [1] CRAN (R 4.1.3)
#> tibble 3.1.6 2021-11-07 [1] CRAN (R 4.1.2)
#> usethis 2.1.2 2021-10-25 [1] CRAN (R 4.1.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.1)
#> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.1)
#> withr 2.4.3 2021-11-30 [1] CRAN (R 4.1.2)
#> xfun 0.29 2021-12-14 [1] CRAN (R 4.1.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.1)
#>
#> [1] C:/Program Files/R/R-4.2.0/library Created on 2022-05-12 by the reprex package (v2.0.1) |
This is strange. No idea. Could you check that zoneinfo does indeed exist at |
The same was happening with me. |
Thank you @vspinu! I am not sure what I am looking for in the zoneinfo. I can confirm that folder zoneinfo exists at Is there a specific file I am looking for in here? Or is this correct? |
You just have to set it as your TZDIR env variable as I mentioned in my last post. It should work from inside an R session. You can also try setting it up before starting R. |
Thank you very much for your reply! I have tried:
and the results are still the same with the error below in the console but no error in the reprex.
Did I correctly execute your suggestions? Do you have any further suggestions for troubleshooting? |
Yes. This is correct. The behavior is puzzling. It's hard to say without debugging locally. CCTZ library which does the time zone loading doesn't expose the actual loading error. |
@shannonpileggi, can you confirm that it works if you switch back to R 4.1.3, but then stops working once you switch to R 4.2.0 again? If you don't have that version of R, you can get it from https://cloud.r-project.org Download R for Windows -> base -> Previous releases -> R 4.1.3 -> R-4.1.3-win.exe I think this is also a direct link to download it Once you install it, you may have to tell RStudio to use it. You can go to Tools -> Global Options -> General and then you should have a menu available to change R versions https://community.rstudio.com/t/use-a-different-r-version-temporarily-in-rstudio/20848/2?u=davis |
Hi @DavisVaughan - thank you for following up! Yes, this is confirmed. 4.1.3Both in the console and in the reprex, under 4.1.3 there are no errors. lubridate:::tzdir_get()
#> [1] "C:/PROGRA~1/R/R-41~1.3/share/zoneinfo"
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "America/New_York"
)
#> [1] "2020-01-01 01:00:00 EST"
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "UTC"
)
#> [1] "2020-01-01 01:00:00 UTC"
callr::r(function() lubridate::mdy("05/11/2022", tz ="America/New_York"))
#> [1] "2022-05-11 EDT"
lubridate:::tzdir_set()
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "America/New_York"
)
#> [1] "2020-01-01 01:00:00 EST"
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 4.1.3 (2022-03-10)
#> os Windows 10 x64 (build 19042)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.1252
#> ctype English_United States.1252
#> tz America/New_York
#> date 2022-05-24
#> pandoc 2.17.1.1 @ C:/Program Files/RStudio/bin/quarto/bin/ (via rmarkdown)
#>
#> - Packages -------------------------------------------------------------------
#> package * version date (UTC) lib source
#> brio 1.1.3 2021-11-30 [1] CRAN (R 4.1.3)
#> cachem 1.0.6 2021-08-19 [1] CRAN (R 4.1.3)
#> callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.3)
#> cli 3.3.0 2022-04-25 [1] CRAN (R 4.1.3)
#> crayon 1.5.1 2022-03-26 [1] CRAN (R 4.1.3)
#> desc 1.4.1 2022-03-06 [1] CRAN (R 4.1.3)
#> devtools 2.4.3 2021-11-30 [1] CRAN (R 4.1.3)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.1.3)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.3)
#> evaluate 0.15 2022-02-18 [1] CRAN (R 4.1.3)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.3)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.3)
#> generics 0.1.2 2022-01-31 [1] CRAN (R 4.1.3)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.3)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.3)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.3)
#> knitr 1.39 2022-04-26 [1] CRAN (R 4.1.3)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.3)
#> lubridate 1.8.0 2021-10-07 [1] CRAN (R 4.1.3)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.1.3)
#> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.1.3)
#> pkgbuild 1.3.1 2021-12-20 [1] CRAN (R 4.1.3)
#> pkgload 1.2.4 2021-11-30 [1] CRAN (R 4.1.3)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.3)
#> processx 3.5.3 2022-03-25 [1] CRAN (R 4.1.3)
#> ps 1.7.0 2022-04-23 [1] CRAN (R 4.1.3)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.3)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.3)
#> remotes 2.4.2 2021-11-30 [1] CRAN (R 4.1.3)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.3)
#> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.3)
#> rmarkdown 2.14 2022-04-25 [1] CRAN (R 4.1.3)
#> rprojroot 2.0.3 2022-04-02 [1] CRAN (R 4.1.3)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.3)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.3)
#> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.1.2)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.3)
#> testthat 3.1.4 2022-04-26 [1] CRAN (R 4.1.3)
#> usethis 2.1.5 2021-12-09 [1] CRAN (R 4.1.3)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.1.3)
#> xfun 0.31 2022-05-10 [1] CRAN (R 4.1.3)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.1.2)
#>
#> [1] C:/Program Files/R/R-4.1.3/library
#>
#> ------------------------------------------------------------------------------ 4.2.0Created on 2022-05-24 by the reprex package (v2.0.1) However, under R 4.2.0 the console yields the error, whereas the reprex does not. lubridate:::tzdir_get()
#> [1] "C:/PROGRA~1/R/R-42~1.0/share/zoneinfo"
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "America/New_York"
)
#> [1] "2020-01-01 01:00:00 EST"
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "UTC"
)
#> [1] "2020-01-01 01:00:00 UTC"
callr::r(function() lubridate::mdy("05/11/2022", tz ="America/New_York"))
#> [1] "2022-05-11 EDT"
lubridate:::tzdir_set()
lubridate::force_tz(
time = lubridate::ymd_hms("2020-01-01 01:00:00 UTC"),
tzone = "America/New_York"
)
#> [1] "2020-01-01 01:00:00 EST"
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.0 (2022-04-22 ucrt)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.utf8
#> ctype English_United States.utf8
#> tz America/New_York
#> date 2022-05-24
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> brio 1.1.2 2021-04-23 [1] CRAN (R 4.1.1)
#> cachem 1.0.6 2021-08-19 [1] CRAN (R 4.1.1)
#> callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.1)
#> cli 3.2.0 2022-02-14 [1] CRAN (R 4.1.3)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.1)
#> desc 1.4.0 2021-09-28 [1] CRAN (R 4.1.1)
#> devtools 2.4.3 2021-11-30 [1] CRAN (R 4.1.3)
#> digest 0.6.28 2021-09-23 [1] CRAN (R 4.1.1)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.1)
#> evaluate 0.15 2022-02-18 [1] CRAN (R 4.1.3)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.1)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.1)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.2)
#> generics 0.1.1 2021-10-25 [1] CRAN (R 4.1.1)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.3)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.1)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1)
#> knitr 1.38 2022-03-25 [1] CRAN (R 4.1.3)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1)
#> lubridate 1.8.0 2021-10-07 [1] CRAN (R 4.1.1)
#> magrittr 2.0.2 2022-01-26 [1] CRAN (R 4.1.3)
#> memoise 2.0.0 2021-01-26 [1] CRAN (R 4.1.1)
#> pillar 1.6.4 2021-10-18 [1] CRAN (R 4.1.1)
#> pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.1.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.1)
#> pkgload 1.2.3 2021-10-13 [1] CRAN (R 4.1.1)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.1)
#> processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.1)
#> ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.1)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.1)
#> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.1.3)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.1.1)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.1.1)
#> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.1.3)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.1)
#> remotes 2.4.1 2021-09-29 [1] CRAN (R 4.1.1)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.1)
#> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.3)
#> rmarkdown 2.11 2021-09-14 [1] CRAN (R 4.1.1)
#> rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.1.1)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.1)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.1)
#> stringi 1.7.5 2021-10-04 [1] CRAN (R 4.1.1)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.1)
#> styler 1.7.0 2022-03-13 [1] CRAN (R 4.1.3)
#> testthat 3.1.3 2022-03-29 [1] CRAN (R 4.1.3)
#> tibble 3.1.6 2021-11-07 [1] CRAN (R 4.1.2)
#> usethis 2.1.2 2021-10-25 [1] CRAN (R 4.1.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.1)
#> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0)
#> withr 2.4.3 2021-11-30 [1] CRAN (R 4.1.2)
#> xfun 0.29 2021-12-14 [1] CRAN (R 4.1.2)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.1)
#>
#> [1] C:/Program Files/R/R-4.2.0/library Created on 2022-05-24 by the reprex package (v2.0.1) |
If you open a fresh instance of RStudio what does the following return for you? Sys.getenv("TZDIR")
library(lubridate)
Sys.getenv("TZDIR") It is important to make sure you are in a fresh rstudio session, lubridate should not be loaded when you call |
I have the same problem as Shannon with distill 1.4 under R 4.2.0 (Windows, lubridate 1.8.0). R 4.2.0
Same error with force_tz(...) No error with
I also checked that my zoneinfo exists in C:\Program Files\R\R-4.2.0\share\zoneinfo\Europe\ And no errors when I switch back to R 4.1.3 R 4.1.3
|
@bwelman as you get no error using callr, I am wondering: do the other tests without it are all inside RStudio IDE ? Do you get an error with R 4.2.0 in R console only ? |
I did all tests inside RStudio IDE. |
Thanks - I was trying to see if somehow this could be linked to RStudio IDE. But it seems not. callr::r(function() lubridate::mdy("05/11/2022", tz ="Europe/Berlin")) and this does not lubridate::mdy("05/11/2022", tz ="Europe/Berlin") This bug is puzzling... |
I gave more detail in the issue I reported on the odbc side (see mention above) but an error message I got hints to the issue being an unwanted reset/default of the timezone lookup to a Linux path, namely "/usr/share/zoneinfo" |
Okay. I am fairly confident I have figured this out. TLDRYou are using R 4.2.0 but have a lubridate built with R 4.1.3. Using packages built with different minor versions of R is NOT supported by R, and is likely to break in a variety of ways. Just run The problemI was able to reproduce this locally on my Windows machine by:
lubridate::force_tz(as.POSIXct("2019-01-01", "UTC"), "America/Chicago")
#> Error: CCTZ: Unrecognized output timezone: "America/Chicago" Here is my session info, which notably shows that I am on R 4.2.0, but have lubridate from R 4.1.3 > devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────────
setting value
version R version 4.2.0 (2022-04-22 ucrt)
os Windows 10 x64 (build 19043)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.utf8
ctype English_United States.utf8
tz America/New_York
date 2022-06-08
rstudio 2022.02.3+492 Prairie Trillium (desktop)
pandoc NA
─ Packages ───────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
<snipped for brevity>
lubridate 1.8.0 2021-10-07 [1] CRAN (R 4.1.3)
<snipped for brevity>
[1] C:/Users/smwhi/AppData/Local/R/win-library/4.2
[2] C:/Program Files/R/R-4.2.0/library Trying to use packages built with different minor versions of R (i.e. 4.1 -> 4.2) is NOT supported by R, and is likely to break a lot of your packages, especially those with compiled code like lubridate. I'm not really sure how you got in this scenario, maybe you copied your package library over using the Windows file explorer? I tried using The solution is to just update lubridate, i.e. I would suggest updating all of your packages to ensure they are all built with R 4.2.0, otherwise you are likely to have more confusing problems or crashes of R in the future. |
Thank you very much, @DavisVaughan! Yes, I must have done something silly when I upgraded to 4.2.0. The issue is now resolved. I really appreciate the follow up and your time to get the bottom of this, especially as it is an error on me. |
@shannonpileggi did you happen to use installr when you upgraded? |
Yes |
That's what I figured. installr will copy over the old package library when you run I think that it shouldn't do that, because it can cause issues like yours, so I'm trying to get them to change it talgalili/installr#172 You didn't do anything wrong here Since this seems to be resolved, I'm going to close this issue |
Also for me the problem is solved. My lubridate 1.8.0 was build with R 4.1.1. |
Indeed, this solves the problem. An easy way to update all packages is to use: |
Hi,
I'm getting the error below.
It works fine when I use
tzone = "UTC"
.Session info
Created on 2022-05-09 by the reprex package (v2.0.1)
Created on 2022-05-09 by the reprex package (v2.0.1)
Related issue: datastorm-open/suncalc#12
The text was updated successfully, but these errors were encountered: