tensorflow: ModuleNotFoundError : from tensorflow.compat.v1 import *

ModuleNotFoundError: No module named tensorflow.compat.v1 in tensorflow==2.2.0-rc3

python == 3.6.8 in MacBook Pro

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 21 (2 by maintainers)

Most upvoted comments

Hi I am using python 3.6 cuda : 10.1 tensorflow-gpu==2.2.0 Ubuntu = 18.04

i am getting this error :

import tensorflow.compat.v1 as tf Traceback (most recent call last): File “”, line 1, in ModuleNotFoundError: No module named ‘tensorflow.compat.v1’

Can anyone please suggest some work around or solution?

If you are running Tensorflow v2.2 and Python 3.6, you can try this workaround:

import tensorflow._api.v2.compat.v1 as tf

If the issue is Mac specific. I am unsure of Mac Platform as I haven’t used it. Hope someone helps here @ravikyram