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

ModuleNotFoundError: No module named 'keras._tf_keras #30

Open
michaelbcerny opened this issue Apr 23, 2024 · 0 comments
Open

ModuleNotFoundError: No module named 'keras._tf_keras #30

michaelbcerny opened this issue Apr 23, 2024 · 0 comments

Comments

@michaelbcerny
Copy link

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:

  1. Create a new virtual environment using reticulate::virtualenv_create(envname = "rmidas_env", python_version = "3.8")
  2. 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")
  3. 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!

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

1 participant