AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'monitoring'

sangeun jo·2021년 10월 10일
0

pip으로 tensorflow를 설치하고나서 실행했더니 다음과 같은 오류를 만났다.

Traceback (most recent call last):
File "app.py", line 11, in
from analysis import gen_frames
File "/home/ubuntu/flask_server/analysis.py", line 2, in
import tensorflow_hub as hub
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow_hub/init.py", line 29, in
from tensorflow_hub.estimator import LatestModuleExporter
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow_hub/estimator.py", line 64, in
class LatestModuleExporter(tf_v1.estimator.Exporter):
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow/python/util/lazy_loader.py", line 62, in getattr
module = self._load()
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow/python/util/lazy_loader.py", line 45, in _load
module = importlib.import_module(self.name)
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow_estimator/init.py", line 10, in
from tensorflow_estimator._api.v1 import estimator
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow_estimator/_api/v1/estimator/init.py", line 13, in
from tensorflow_estimator._api.v1.estimator import tpu
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow_estimator/_api/v1/estimator/tpu/init.py", line 14, in
from tensorflow_estimator.python.estimator.tpu.tpu_estimator import TPUEstimator
File "/home/ubuntu/Downloads/anaconda3/envs/big3/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/tpu/tpu_estimator.py", line 108, in
_tpu_estimator_gauge = tf.compat.v2.internal.monitoring.BoolGauge(
AttributeError: module 'tensorflow.compat.v2.internal' has no attribute 'monitoring'

pip으로 tensorflow를 uninstall하고, pip으로 tensorflow-cpu를 설치하니 오류가 해결되었다. cpu환경에서는 tensorflow-cpu를 설치해야하나보다.

profile
코더가 아니라 개발자가 되자

0개의 댓글