'cannot import name '_pywrap_dtensor_device' from 'tensorflow.python'

I uninstalled and installed Tensorflow. I updated. I got the same error. I ran the program a lot and it didn't give an error until yesterday I installed pip install tf-nightly-gpu. Is that why?

File "C:\Users\faikm\OneDrive\Masaüstü\DeeepLearning\model_egit.py", line 14, in <module>
    from tensorflow.keras import layers
  File "C:\Program Files\Python310\lib\site-packages\keras\api\_v2\keras\__init__.py", line 12, in <module>
    from keras import __version__
  File "C:\Program Files\Python310\lib\site-packages\keras\__init__.py", line 24, in <module>
    from keras import models
  File "C:\Program Files\Python310\lib\site-packages\keras\models\__init__.py", line 18, in <module>
    from keras.engine.functional import Functional
  File "C:\Program Files\Python310\lib\site-packages\keras\engine\functional.py", line 24, in <module>
    from keras.dtensor import layout_map as layout_map_lib
  File "C:\Program Files\Python310\lib\site-packages\keras\dtensor\__init__.py", line 22, in <module>
    from tensorflow.compat.v2.experimental import dtensor as dtensor_api  # pylint: disable=g-import-not-at-top
  File "C:\Program Files\Python310\lib\site-packages\tensorflow\_api\v2\compat\v2\experimental\dtensor\__init__.py", line 8, in <module>
    from tensorflow.dtensor.python.api import call_with_layout
  File "C:\Program Files\Python310\lib\site-packages\tensorflow\dtensor\python\__init__.py", line 18, in <module>
    from tensorflow.dtensor.python import mesh_util
  File "C:\Program Files\Python310\lib\site-packages\tensorflow\dtensor\python\mesh_util.py", line 21, in <module>
    from tensorflow.dtensor.python import api
  File "C:\Program Files\Python310\lib\site-packages\tensorflow\dtensor\python\api.py", line 22, in <module>
    from tensorflow.dtensor.python import dtensor_device
  File "C:\Program Files\Python310\lib\site-packages\tensorflow\dtensor\python\dtensor_device.py", line 28, in <module>
    from tensorflow.python import _pywrap_dtensor_device
ImportError: cannot import name '_pywrap_dtensor_device' from 'tensorflow.python' (C:\Program Files\Python310\lib\site-packages\tensorflow\python\__init__.py)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source