雲のメモ帳

猫とクラウドと旅行が好きなインフラエンジニアです。 日々の調べたことや興味が持ったことをこのブログにアウトプットします。

'tensorflow_core._api.v2.io.gfile' has no attribute 'get_filesystem' エラーの対処法

これはなに?

久々にTensorBoardを使おうと思ったら表題のエラーが出てハマったので対処方法を残しておきます。

エラー内容

tensorflow_core._api.v2.io.gfile' has no attribute 'get_filesystem

対処法

結論から言うと以下のように gfileを定義するとエラーが解消されました。

import tensorflow as tf
import tensorboard as tb
tf.io.gfile = tb.compat.tensorflow_stub.io.gfile

本課題に関するIssueはこちら。
'tensorflow_core._api.v2.io.gfile' has no attribute 'get_filesystem' · Issue #30966 · pytorch/pytorch · GitHub

You can create a new environment, then install pytorch and tensorboard. Note: you should not install tensorflow as there would be a kind of conflict with tensorboard.

Tensorflowを削除すれば動くみたいな記述があったので、クリーンインストールしたのですが、私の環境では解決しませんでした。

TensorFlowとか機械学習周りのライブラリは依存関係が複雑すぎて環境構築が大変だ...