rstudio / bundle

Prepare objects for serialization with a consistent interface
https://rstudio.github.io/bundle/
Other
27 stars 4 forks source link

Better way to check for tensorflow #53

Closed juliasilge closed 1 year ago

juliasilge commented 1 year ago

On the advice of @t-kalinowski this is a better way to check if tensorflow is installed.

t-kalinowski commented 1 year ago

I may have confused two functions in the reticulate namespace when we talked: only one of which is exported. reticulate:::python_has_module() will probe the python installation without attempting to initialize Python in the R session. Unfortunately, reticulate::py_module_available() suffers from the same problem as tf_config(), it will cause reticulate to initialize Python.

Perhaps the better fix would be to guard the entire example with:

skip_on_cran()