Skip to content

Commit

Permalink
simplify install
Browse files Browse the repository at this point in the history
stop chasing segfault that only appears in Python >=3.10
  • Loading branch information
t-kalinowski committed Oct 19, 2023
1 parent 6651394 commit c11fc53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
15 changes: 8 additions & 7 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
install_keras <- function(...,
envname = "r-keras",
extra_packages = NULL,
python_version = "3.9",
backend = c("tensorflow", "jax", "pytorch")
python_version = "3.9"
# backend = c("tensorflow", "jax", "pytorch")
) {
# # envname = "r-keras",
# # new_env = identical(envname, "r-keras")
Expand Down Expand Up @@ -52,12 +52,13 @@ install_keras <- function(...,
# browser()
system2 <- reticulate:::system2t
system2("git", "pull")
# system2(python, c("-m pip install -r requirements.txt")) # unpin tf-nightly for Python 3.12
system2(python, c("-m pip install -r requirements.txt")) # unpin tf-nightly for Python 3.12

# system2(python, c("-m pip install ipython")) # for interactive debugging
# system2(python, c("-m pip install -r requirements-common.txt"))
# system2(python, c("-m pip install torch torchvision")) # needed for pip_build.py?? (but why?)
# system2(python, c("-m pip install tf-nightly jax[cpu]")) # unpin tf-nightly for Python 3.12

system2(python, c("-m pip install ipython")) # for interactive debugging
system2(python, c("-m pip install -r requirements-common.txt"))
system2(python, c("-m pip install torch torchvision")) # needed for pip_build.py?? (but why?)
system2(python, c("-m pip install tf-nightly jax[cpu]")) # unpin tf-nightly for Python 3.12
system2(python, c("pip_build.py --install"))
message("Done!")

Expand Down
3 changes: 1 addition & 2 deletions man/install_keras.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions tests/testthat/helper-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# 3 = INFO, WARNING, and ERROR messages are not printed


print_keras_config <- function() {

reticulate:::py_register_load_hook("keras", function() {
print(reticulate::py_config())
# print(keras$`__version__`)
# print(keras$`__path__`)
Expand All @@ -20,13 +21,8 @@ print_keras_config <- function() {
# keras$layers # force load
# py_main$keras <- keras
# py_eval("keras.config.disable_traceback_filtering()")
}
})

if(reticulate::py_available()) {
print_keras_config()
} else {
setHook("reticulate.onPyInit", print_keras_config)
}

if (reticulate::py_module_available("tensorflow")) {
# force verbose tf init messages early
Expand Down

0 comments on commit c11fc53

Please sign in to comment.