I enjoyed reading your paper in Political Analysis, and I'm now trying to implement the 'rMIDAS' package in R. I'm encountering a ModuleNotFoundError: No module named 'keras._tf_keras' error when attempting to use TensorFlow and TensorFlow Addons via the reticulate package in R. This issue persists despite setting up a clean Python environment and ensuring that compatible versions of TensorFlow and TensorFlow Addons are installed.
My specifications:
- Platform: Posit Cloud
- R version: 4.3.3
- Python version: 3.11.4
- TensorFlow version: 2.16.1 (also attempted with 2.15.0)
- TensorFlow Addons version: 0.20.0
To recreate the error:
- Create a new virtual environment using
reticulate::virtualenv_create(envname = "rmidas_env", python_version = "3.8")
- Install TensorFlow and TensorFlow Addons:
reticulate::py_install("tensorflow==2.15.0", envname = "rmidas_env")
reticulate::py_install("tensorflow-addons==0.20.0", envname = "rmidas_env")
- Attempt to import TensorFlow and TensorFlow Addons in R:
reticulate::py_run_string("import tensorflow")
reticulate::py_run_string("import tensorflow_addons")
The issue seems related to how TensorFlow Addons interacts with the TensorFlow/Keras integration (adjustments to the versions and reinstallation of packages did not resolve the issue).
Do you have any suggestions?
Thank you for looking into this!
I enjoyed reading your paper in Political Analysis, and I'm now trying to implement the 'rMIDAS' package in R. I'm encountering a
ModuleNotFoundError: No module named 'keras._tf_keras'error when attempting to use TensorFlow and TensorFlow Addons via thereticulatepackage in R. This issue persists despite setting up a clean Python environment and ensuring that compatible versions of TensorFlow and TensorFlow Addons are installed.My specifications:
To recreate the error:
reticulate::virtualenv_create(envname = "rmidas_env", python_version = "3.8")reticulate::py_install("tensorflow==2.15.0", envname = "rmidas_env")reticulate::py_install("tensorflow-addons==0.20.0", envname = "rmidas_env")reticulate::py_run_string("import tensorflow")reticulate::py_run_string("import tensorflow_addons")The issue seems related to how TensorFlow Addons interacts with the TensorFlow/Keras integration (adjustments to the versions and reinstallation of packages did not resolve the issue).
Do you have any suggestions?
Thank you for looking into this!