실행환경
os : Linux Mint 19.2 (Tina)
python 3.10.4
tensorboard 2.6.0 : conda-forge
tensorflow-gpu 2.7.0
Tensorboard를 수행하다 다음과 같은 에러가 나오면서 실행이 되지 않음.
tensorboard --logdir ./log --port 8080
을 수행할 경우 실행이 아예 안되고 다음과 같은 traceback이 출력됨.
Traceback (most recent call last):
File "/home/dsaint31/miniconda3/envs/ct/bin/tensorboard", line 6, in <module>
from tensorboard.main import run_main
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/main.py", line 27, in <module>
from tensorboard import default
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/default.py", line 33, in <module>
from tensorboard.plugins.audio import audio_plugin
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/plugins/audio/audio_plugin.py", line 23, in <module>
from tensorboard import plugin_util
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/plugin_util.py", line 20, in <module>
from tensorboard._vendor.bleach.sanitizer import Cleaner
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/bleach/__init__.py", line 5, in <module>
from tensorboard._vendor.bleach.linkifier import (
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/bleach/linkifier.py", line 4, in <module>
from tensorboard._vendor import html5lib
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/__init__.py", line 25, in <module>
from .html5parser import HTMLParser, parse, parseFragment
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/html5parser.py", line 8, in <module>
from . import _tokenizer
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/_tokenizer.py", line 16, in <module>
from ._trie import Trie
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/_trie/__init__.py", line 3, in <module>
from .py import Trie as PyTrie
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/_trie/py.py", line 6, in <module>
from ._base import Trie as ABCTrie
File "/home/dsaint31/miniconda3/envs/ct/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/_trie/_base.py", line 3, in <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/home/dsaint31/miniconda3/envs/ct/lib/python3.10/collections/__init__.py)
해결.
에러를 보면, tensorboard에서 사용하는 html5lib
에 문제가 있는 것으로 보임.
다행히도 https://github.com/tensorflow/tensorboard/issues/5478에 해당 에러가 보고되어있었음.
tensorboard에서 html5lib
를 1.1이상으로 업그레이드하는 게 이상적인 해법이지만, 일단 임시방편으로 다음과 같이 하면 됨.
Tensorboard가 설치된 곳의 html5lib
디렉토리의 _trie/_base.py
를 다음과 같이 수정.
- 내 경우의 miniconda 가상환경의 경로는 다음과 같았음:
~/miniconda3/envs/[conda_환경명]/lib/python3.10/site-packages/tensorboard/_vendor/html5lib/_trie/_base.py
from __future__ import absolute_import, division, unicode_literals
#from collections import Mapping #original
from collections.abc import Mapping #modified
# 이하 생략
Reference
https://github.com/tensorflow/tensorboard/issues/5478
'Programming' 카테고리의 다른 글
[Python] 현재 사용 중인 Python 및 패키지의 실제 경로 확인하기. (2) | 2022.07.18 |
---|---|
[ML] Summary SVM (0) | 2022.05.30 |
[ML] Entropy, KL-Divergence, and Cross-entropy (0) | 2022.05.12 |
[Conda] miniconda의 기본 채널 변경 : conda-forge (3) | 2022.04.05 |
sh파일에서 conda 가상환경 activation! (2) | 2021.12.05 |