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

Error: No TensorFlow Probability python installation found. This can be installed using the installTF() function. #2

Open
skf-git opened this issue Aug 12, 2020 · 3 comments

Comments

@skf-git
Copy link

skf-git commented Aug 12, 2020

Hello,

It keeps sending this error but I can't figure out what to correct,

I am using Anaconda and launching my jupyter notebook from an R and python environment that I created where I have the packages of tensorflow probability 0.8.0 , and r-sgmcmc 0.2.4.

with this, I had a warning to ensure that tensorflow is of a compatible version

so in my anaconda's packages, I disabled tensorflow and tensorflow-base 2.0.0 and left r-tensorflow 1.13.1 and tensorflow probability 0.8.0 , I no longer had the warning after loading the library :
library(sgmcmc)

but I then when I run the code :

sgld = sgldSetup(logLik, dataset, params, stepsize, logPrior = logPrior, 
        minibatchSize = 500, seed = 13)

I got the message :

Error: No TensorFlow Probability python installation found. This can be installed using the installTF() function.
Traceback:

  1. sgldSetup(logLik, dataset, params, stepsize, logPrior = logPrior,
    . minibatchSize = 500, seed = 13)
  2. createSGMCMC(logLik, logPrior, dataset, params, stepsize, minibatchSize,
    . seed)
  3. checkTFInstall()
  4. stop(tfpErrorMsg(), call. = FALSE)

I run sgmcmc::installTF() and tensorflow::install_tensorflow()

I still get the same error,
I also have tried installing the packages from CRAN repository url in RStudio (launched from the same environment) , I get this same error,

Thank you!

@chris-nemeth
Copy link
Member

Are you using the master version of the package from Github? There was an issue with the checkTFInstall() function in createSGMCMC. This was flagged by another use and our solution was to remove the checkTFInstall() which seemed to fix the issue. Unfortunately, we have pushed this change to the CRAN version of the package yet.

@skf-git
Copy link
Author

skf-git commented Aug 16, 2020

Thank you for your reply,

I have used the installation instruction in README.md , install.packages("sgmcmc") and sgmcmc::installTF() , so from CRAN , I now tried the master version of the package from Github using install_github("STOR-i/sgmcmc") but then I get this error: ( and cannot load the library(sgmcmc))

`Error: (converted from warning) cannot remove prior installation of package 'digest'
Traceback:

  1. install_github("STOR-i/sgmcmc")
  2. install_remotes(remotes, auth_token = auth_token, host = host,
    . dependencies = dependencies, upgrade = upgrade, force = force,
    . quiet = quiet, build = build, build_opts = build_opts, repos = repos,
    . type = type, ...)
  3. vapply(remotes, install_remote, ..., FUN.VALUE = character(1))
  4. FUN(X[[i]], ...)
  5. install(source, dependencies = dependencies, upgrade = upgrade,
    . force = force, quiet = quiet, build = build, build_opts = build_opts,
    . repos = repos, type = type, ...)
  6. install_deps(pkgdir, dependencies = dependencies, quiet = quiet,
    . build = build, build_opts = build_opts, upgrade = upgrade,
    . repos = repos, type = type)
  7. update(packages, dependencies = dep_deps, quiet = quiet, upgrade = upgrade,
    . build = build, build_opts = build_opts, ...)
  8. update.package_deps(packages, dependencies = dep_deps, quiet = quiet,
    . upgrade = upgrade, build = build, build_opts = build_opts,
    . ...)
  9. install_packages(object$package[object$is_cran & behind], repos = r$repos,
    . type = r$pkg_type, dependencies = dependencies, quiet = quiet,
    . ...)
  10. do.call(safe_install_packages, c(list(packages, repos = repos,
    . type = type, dependencies = dependencies, quiet = quiet),
    . args))
  11. (function (...)
    . {
    . lib <- paste(.libPaths(), collapse = .Platform$path.sep)
    . if (!is_standalone() && has_package("crancache") && has_package("callr")) {
    . i.p <- "crancache" %::% "install_packages"
    . }
    . else {
    . i.p <- utils::install.packages
    . }
    . with_envvar(c(R_LIBS = lib, R_LIBS_USER = lib, R_LIBS_SITE = lib,
    . RGL_USE_NULL = "TRUE"), if (should_error_for_warnings()) {
    . with_options(list(warn = 2), with_rprofile_user("options(warn = 2)",
    . i.p(...)))
    . }
    . else {
    . i.p(...)
    . })
    . })(c("config", "digest", "jsonlite", "processx", "ps", "purrr",
    . "R6", "rappdirs", "Rcpp", "reticulate", "rstudioapi", "tensorflow",
    . "tfruns", "whisker", "yaml"), repos = c(CRAN = "https://cran.r-project.org"),
    . type = "both", dependencies = NA, quiet = FALSE)
  12. with_envvar(c(R_LIBS = lib, R_LIBS_USER = lib, R_LIBS_SITE = lib,
    . RGL_USE_NULL = "TRUE"), if (should_error_for_warnings()) {
    . with_options(list(warn = 2), with_rprofile_user("options(warn = 2)",
    . i.p(...)))
    . } else {
    . i.p(...)
    . })
  13. force(code)
  14. with_options(list(warn = 2), with_rprofile_user("options(warn = 2)",
    . i.p(...)))
  15. force(code)
  16. with_rprofile_user("options(warn = 2)", i.p(...))
  17. with_envvar(c(R_PROFILE_USER = temp_rprofile), {
    . force(code)
    . })
  18. force(code)
  19. force(code)
  20. i.p(...)
  21. .install.winbinary(pkgs = bins, lib = lib, contriburl = contrib.url(repos,
    . type2), method = method, available = av2, destdir = destdir,
    . dependencies = NULL, libs_only = libs_only, quiet = quiet,
    . ...)
  22. unpackPkgZip(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib, libs_only,
    . lock)
  23. warning(gettextf("cannot remove prior installation of package %s",
    . sQuote(pkgname)), domain = NA, call. = FALSE, immediate. = TRUE)
  24. .signalSimpleWarning("cannot remove prior installation of package 'digest'",
    . base::quote(NULL))
  25. withRestarts({
    . .Internal(.signalCondition(simpleWarning(msg, call), msg,
    . call))
    . .Internal(.dfltWarn(msg, call))
    . }, muffleWarning = function() NULL)
  26. withOneRestart(expr, restarts[[1L]])
  27. doWithOneRestart(return(expr), restart)`

I tried removing the previous r-digest 0.6.9 from Anaconda then manually installing specific version but I am getting different other errors. But this is a different matter, I'll try to tackle these.

@mshane87
Copy link

mshane87 commented Mar 4, 2022

Hi @skf-git, I had the same issue. Then, I found that sgmcmc::installTF() was actually not working properly to solve the compatibility issues and the tensorflow-probability was not getting installed properly. You can follow the steps that I followed.

  • Install Tensorflow for R, Keras for R and rStan pkgs from RStudio. Visit Tensorflow . Use
    install.packages(“tensorflow”)
    install.packages(“keras”)
    install.packages(“rstan”)
    for installing packages in R and remove.packages(“pkgname”) for uninstalling a pkg.
  • Create separate conda environment (r-reticulate) for Python for R, from R. Visit RStudio . Also, visit Anaconda for managing conda environments including path specification for a particular environment. It also has complete Anaconda user guide. By default, it will be created in the current user directory. Use
    library(reticulate)
    conda_create(“r-reticulate”)
  • Install Keras and Tensorflow Python packages by restarting RStudio and then using
    use_condaenv(“r-reticulate”)
    keras::install_keras()
  • Next, install tensorflow-probability python pkg by again restarting RStudio and using
    keras::install_keras(extra_packages = “tensorflow-probability”)
  • Install sgmcmc pkg (for SGMCMC) using
    install.packages(“sgmcmc”)

But then there will be an AttributeError because I think sgmcmc pkg is written for Tensorflow v1 (specifically 1.13.1). So, you will have to solve this issue. For doing this please visit Tensorflow. This will solve future compatibility issues, hopefully.

best regards

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