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

R packages cannot find tzdata because TZDIR not set #9

Open
1 task done
tjbencomo opened this issue Jun 24, 2021 · 2 comments
Open
1 task done

R packages cannot find tzdata because TZDIR not set #9

tjbencomo opened this issue Jun 24, 2021 · 2 comments

Comments

@tjbencomo
Copy link

tjbencomo commented Jun 24, 2021

Issue:

R packages like readr that rely on tzdata fail to find tzdata when running in a Snakemake workflow using a Mambaforge singularity container and conda environment.

StackOverflow Issue

This problem is remedied by setting TZDIR at the beginning of R scripts before loading packages:

Sys.setenv("TZDIR"=paste0(Sys.getenv("CONDA_PREFIX"), "/share/zoneinfo"))
library(readr)

It has been suggested tzdata set TZDIR to point to $CONDA_PREFIX/share/zoneinfo to remedy this issue


Environment (conda list):
$ conda list

#env.yml
name: env
channels:
    - default
    - bioconda
    - conda-forge
dependencies:
    - r-readr
    - tzdata


Details about conda and system ( conda info ):
$ conda info

@drhagen
Copy link

drhagen commented Apr 27, 2023

I have this issue too. I almost made an issue on r-lubridate before realizing that this is probably the correct place to fix this. If tzdata is installed in the conda environment, then I definitely want everything in the environment that understands the TZDIR variable to use this package.

@h-vetinari
Copy link
Member

For R in particular, there's also a package called r-tzdb which might be easier to interface with. It ships more than just tzdata (AFAIU also tzcode), but also some R-specific things.

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

3 participants