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

turn off reticulate's autoconfig when initialising python #2

Conversation

goldingn
Copy link

in check_tf_version()

@goldingn
Copy link
Author

I think check_tf_version() is always the first place python could be initialised in a greta session (it's called in the creation of all greta arrays, and you can't invoke TF without creating a greta array). So this should cover all bases.

The only possible exception I can think of is if a user saves some greta arrays in one session, then starts a new session and then does things with them that call python (creates a model, does MCMC, etc.). If that is the case, we will want to run check_tf_version() in those situations that call python too. We'd want that anyway as we'd want to check the versions are correct.

The heavy-handed alternative would be to set this environment variable for the whole R session, whenever greta is loaded. But that seems icky.

@njtierney
Copy link
Owner

Looks good to me, I had tried out a version where I checked for an option that we could set, like, greta.python_autoconfig, but I think this on.exit is safer as it reverts back to whatever state the user had previously set.

So it sounds like the potential issue you mentioned there could be resolved by ensuring check_tf_version() is called in other key modelling steps, like mcmc, or model ?

@njtierney njtierney merged commit 07597c9 into njtierney:njt-only-install-greta-deps May 21, 2021
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

Successfully merging this pull request may close these issues.

2 participants