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

No module named 'tensorflow_probability' #155

Open
TomasVrzal opened this issue Feb 28, 2022 · 2 comments
Open

No module named 'tensorflow_probability' #155

TomasVrzal opened this issue Feb 28, 2022 · 2 comments

Comments

@TomasVrzal
Copy link

I tried to install tfprobability package, however, after installation and typing library(tfprobability) the following error occurred:

Error: package or namespace load failed for ‘tfprobability’:
.onLoad failed in loadNamespace() for 'tfprobability', details:
call: py_module_import(module, convert = convert)
error: ModuleNotFoundError: No module named 'tensorflow_probability'

Detailed traceback:
File "C:\Users\ibis\Documents\R\win-library\4.0\reticulate\python\rpytools\loader.py", line 44, in _import_hook
level=level

I also tried the next step: tfprobability::install_tfprobability()
But the same error occurred.

Can someone help me with this issue, please?

@t-kalinowski
Copy link
Member

Hello, thanks for filing.

Many installation issues are resolved by running the following in a fresh R session (you can restart R in Rstudio with Ctrl+Shift+F10) :

# install the development version of packages, in case the
# issue is already fixed but not on CRAN yet.
install.packages("remotes")
remotes::install_github(sprintf("rstudio/%s", c("reticulate", "tensorflow", "keras")))
reticulate::miniconda_uninstall() # start with a blank slate
reticulate::install_miniconda()
tfprobability::install_tfprobability()

Test to see if installation was successful.

tensorflow::as_tensor("Hello World")

If the above snippet succeeded and you saw something like tf.Tensor(b'Hello World', shape=(), dtype=string), then 🎉, you've successfully installed Tensorflow.

If the above installation failed, please gather some diagnostic info:

reticulate::py_config()
tensorflow::tf_config()
reticulate::import("tensorflow")
reticulate::py_last_error()
sessionInfo()

Please copy and paste the FULL OUTPUT of running all three snippets, and be sure to enclose the output lines with three backticks (```) for monospace formatting.

@TomasVrzal
Copy link
Author

TomasVrzal commented Mar 1, 2022

Originally, the first snippet does not help. However, the output indicated that Rtools is not installed and that Rcpp, jsonlite, and reticulate packages can not be successfully installed since the former installation is in the library folder.
Therefore, I installed Rtools and removed the packages. Then I tried to run the first snippet of code - without any error.

The output of the second snippet:
tf.Tensor(b'Hello World', shape=(), dtype=string)

It looks that it works already.

Thank you very much for your help.

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

2 participants