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

Improve installation of dependencies #417

Merged
merged 99 commits into from
Jun 4, 2021

Conversation

njtierney
Copy link
Collaborator

@njtierney njtierney commented May 21, 2021

Provides a new process for installing python dependencies, and a better user experience for dealing with this.

It addresses this by installing the needed python packages into a special "greta-env" conda environment. This can be thought of as similar to a docker container, or a renv.lock file. Our specified python dependencies are all put into this "greta-env" environment, which greta checks exists when loading up greta.

An example of this new process is shown below:

# wipe out the good environment
library(reticulate)
conda_remove("greta-env")

# set up a new, different environment
env <- tempfile("python-env-")
conda_create(env)
use_condaenv(env, required = TRUE)
reticulate::py_discover_config()

# try to run greta
library(greta)
x <- normal(0, 1)
# message appears
Error: We have detected that you do not have the 'greta-env' condaenvironment and python packages setup. You can set these up using:

	install_greta_deps()

and then call:

	library(greta)

in a fresh R session that has not yet initialised Tensorflow.
For more information, see ?install_greta_deps 
# run this, as requested
install_greta_deps()

# <restart here> as requested
library(greta)
x <- normal(0, 1)
# it hangs here for a minute
# I wonder what is taking it so long?
m <- model(x)
draws <- mcmc(m)
# woohoo!

Resolves #396

Nicholas Tierney and others added 30 commits April 28, 2021 14:16
This will probably be skipped on CRAN but at the moment I need to test if the new config/reticulate option works properly
…as the latter retuns an object of class "package_version".
njtierney and others added 14 commits May 3, 2021 12:03
* Installs specific versions of tensorflow (1.14.0), tensorflow probability (0.7.0), and numpy (1.16.4)
* Establish new helper file that does conda_create and then establishes the right python version (3.7), and other python packages and versions to install
add to automatic dependency installation steps; tidy up messaging
…ta_deps`, and update instructions on using `install_greta_deps`.
turn off reticulate's autoconfig when initialising python
@njtierney
Copy link
Collaborator Author

njtierney commented May 21, 2021

Todo list:

  • Move installation things from create_greta_env() into install_greta_deps()
  • Document potential issues regarding installing miniconda - "If you run reticulate::install_miniconda() when you already have miniconda in the usual location, you end up with two conda installations, which can be awkward" (test this with users at work to see if this makes sense)
  • Document any extra things about the greta env somewhere. E.g., advanced users can install their own set up in a different environment if they want! (add a bit of a note about this in the documentation)

@njtierney njtierney force-pushed the njt-only-install-greta-deps branch from d884cc6 to 35c8b96 Compare June 3, 2021 01:33
add 'depends.rds' to Rbuildignore to remove a note on github actions
@njtierney
Copy link
Collaborator Author

Going to merge this as the only GH action that is breaking is some obscure fail where fields doesn't install

@njtierney njtierney merged commit 13b9ad1 into greta-dev:master Jun 4, 2021
@njtierney njtierney deleted the njt-only-install-greta-deps branch June 4, 2021 02:16
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.

isolate useful gh install components for TF into helper functions
2 participants