tensorflow/tensorboard

Exception when debugging in pycharm

miniwa opened this issue · 5 comments

Consider Stack Overflow for getting support using TensorBoard—they have
a larger community with better searchability:

https://stackoverflow.com/questions/tagged/tensorboard

Do not use this template for for setup, installation, or configuration
issues. Instead, use the “installation problem” issue template:

https://github.com/tensorflow/tensorboard/issues/new?template=installation_problem.md

To report a problem with TensorBoard itself, please fill out the
remainder of this template.

Environment information (required)

Please run diagnose_tensorboard.py (link below) in the same
environment from which you normally run TensorFlow/TensorBoard, and
paste the output here:

Diagnostics

Diagnostics output
--- check: autoidentify
INFO: diagnose_tensorboard.py version c6ca9f1d004e2a1bc7c160abc43be229b82cad7e

--- check: general
INFO: sys.version_info: sys.version_info(major=3, minor=12, micro=0, releaselevel='final', serial=0)
INFO: os.name: nt
INFO: os.uname(): N/A
INFO: sys.getwindowsversion(): sys.getwindowsversion(major=10, minor=0, build=22631, platform=2, service_pack='')

--- check: package_management
INFO: has conda-meta: False
INFO: $VIRTUAL_ENV: None

--- check: installed_packages
INFO: installed: tensorboard==2.16.2
WARNING: no installation among: ['tensorflow', 'tensorflow-gpu', 'tf-nightly', 'tf-nightly-2.0-preview', 'tf-nightly-gpu', 'tf-nightly-gpu-2.0-preview']
WARNING: no installation among: ['tensorflow-estimator', 'tensorflow-estimator-2.0-preview', 'tf-estimator-nightly']
INFO: installed: tensorboard-data-server==0.7.2

--- check: tensorboard_python_version
INFO: tensorboard.version.VERSION: '2.16.2'

--- check: tensorflow_python_version
Traceback (most recent call last):
  File "C:\Projects\osrs-rl\diagnose_tensorboard.py", line 511, in main
    suggestions.extend(check())
                       ^^^^^^^
  File "C:\Projects\osrs-rl\diagnose_tensorboard.py", line 81, in wrapper
    result = fn()
             ^^^^
  File "C:\Projects\osrs-rl\diagnose_tensorboard.py", line 267, in tensorflow_python_version
    import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

--- check: tensorboard_data_server_version
INFO: data server binary: None

--- check: tensorboard_binary_path
INFO: which tensorboard: b'C:\\Users\\miniwa\\AppData\\Local\\Programs\\Python\\Python312\\Scripts\\tensorboard.exe\r\n'

--- check: addrinfos
socket.has_ipv6 = True
socket.AF_UNSPEC = <AddressFamily.AF_UNSPEC: 0>
socket.SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
socket.AI_ADDRCONFIG = <AddressInfo.AI_ADDRCONFIG: 1024>
socket.AI_PASSIVE = <AddressInfo.AI_PASSIVE: 1>
Loopback flags: <AddressInfo.AI_ADDRCONFIG: 1024>
Loopback infos: [(<AddressFamily.AF_INET6: 23>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('::1', 0, 0, 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('127.0.0.1', 0))]
Wildcard flags: <AddressInfo.AI_PASSIVE: 1>
Wildcard infos: [(<AddressFamily.AF_INET6: 23>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('::', 0, 0, 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('0.0.0.0', 0))]

--- check: readable_fqdn
INFO: socket.getfqdn(): 'DESKTOP-48C7N5V'

--- check: stat_tensorboardinfo
INFO: directory: C:\Users\miniwa\AppData\Local\Temp\.tensorboard-info
INFO: os.stat(...): os.stat_result(st_mode=16895, st_ino=5348024557574303, st_dev=8242826645470637811, st_nlink=1, st_uid=0, st_gid=0, st_size=4096, st_atime=1712550307, st_mtime=1712550307, st_ctime=1709296394)
INFO: mode: 0o40777

--- check: source_trees_without_genfiles
INFO: tensorboard_roots (1): ['C:\\Users\\miniwa\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages']; bad_roots (0): []

--- check: full_pip_freeze
INFO: pip freeze --all:
absl-py==2.1.0
accelerate==0.28.0
alembic==1.13.1
anyio==4.3.0
appdirs==1.4.4
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==2.4.1
async-lru==2.0.4
attrs==23.2.0
Babel==2.14.0
beautifulsoup4==4.12.3
bleach==6.1.0
box2d-py==2.3.5
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
colorama==0.4.6
colorlog==6.8.2
comm==0.2.2
contourpy==1.2.0
cycler==0.12.1
debugpy==1.8.1
decorator==5.1.1
defusedxml==0.7.1
docker-pycreds==0.4.0
executing==2.0.1
Farama-Notifications==0.0.4
fastjsonschema==2.19.1
filelock==3.13.1
fire==0.6.0
fonttools==4.49.0
fqdn==1.5.1
fsspec==2024.2.0
gitdb==4.0.11
GitPython==3.1.42
greenlet==3.0.3
grpcio==1.62.0
gymnasium==0.29.1
h11==0.14.0
h5py==3.10.0
httpcore==1.0.5
httpx==0.27.0
huggingface-hub==0.22.2
idna==3.6
iniconfig==2.0.0
ipykernel==6.29.4
ipython==8.23.0
ipywidgets==8.1.2
isoduration==20.11.0
jedi==0.19.1
Jinja2==3.1.3
json5==0.9.24
jsonpointer==2.4
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.10.0
jupyter-lsp==2.2.4
jupyter_client==8.6.1
jupyter_core==5.7.2
jupyter_server==2.13.0
jupyter_server_terminals==0.5.3
jupyterlab==4.1.5
jupyterlab_pygments==0.3.0
jupyterlab_server==2.25.4
jupyterlab_widgets==3.0.10
kiwisolver==1.4.5
llvmlite==0.42.0
Mako==1.3.2
Markdown==3.5.2
MarkupSafe==2.1.5
matplotlib==3.8.3
matplotlib-inline==0.1.6
mistune==3.0.2
mpmath==1.3.0
nbclient==0.10.0
nbconvert==7.16.3
nbformat==5.10.4
nest-asyncio==1.6.0
networkx==3.2.1
notebook==7.1.2
notebook_shim==0.2.4
numba==0.59.0
numpy==1.26.4
opencv-python==4.9.0.80
optuna==3.5.0
overrides==7.7.0
packaging==23.2
pandas==2.2.1
pandocfilters==1.5.1
parso==0.8.4
pettingzoo==1.24.3
pillow==10.2.0
pip==23.2.1
platformdirs==4.2.0
pluggy==1.4.0
prometheus_client==0.20.0
prompt-toolkit==3.0.43
protobuf==4.25.3
psutil==5.9.8
pure-eval==0.2.2
pycparser==2.22
pygame==2.5.2
Pygments==2.17.2
pyparsing==3.1.1
pytest==8.1.1
python-dateutil==2.9.0
python-json-logger==2.0.7
pytz==2024.1
pywin32==306
pywinpty==2.0.13
PyYAML==6.0.1
pyzmq==25.1.2
qtconsole==5.5.1
QtPy==2.4.1
referencing==0.34.0
requests==2.31.0
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.18.0
safetensors==0.4.2
Send2Trash==1.8.2
sentry-sdk==1.42.0
setproctitle==1.3.3
setuptools==69.1.1
six==1.16.0
smmap==5.0.1
sniffio==1.3.1
soupsieve==2.5
SQLAlchemy==2.0.28
stable-baselines3==2.2.1
stack-data==0.6.3
swig==4.2.1
sympy==1.12
tensorboard==2.16.2
tensorboard-data-server==0.7.2
termcolor==2.4.0
terminado==0.18.1
tianshou==0.5.1
tinycss2==1.2.1
torch==2.2.1
torch-summary==1.4.5
torchaudio==2.2.1
torchvision==0.17.1
tornado==6.4
tqdm==4.66.2
traitlets==5.14.2
types-python-dateutil==2.9.0.20240316
typing_extensions==4.10.0
tzdata==2024.1
uri-template==1.3.0
urllib3==2.2.1
wandb==0.16.4
wcwidth==0.2.13
webcolors==1.13
webencodings==0.5.1
websocket-client==1.7.0
Werkzeug==3.0.1
wheel==0.42.0
widgetsnbextension==4.0.10

For browser-related issues, please additionally specify:

  • Browser type and version (e.g., Chrome 64.0.3282.140):
  • Screenshot, if it’s a visual issue:

Issue description

Tensorboard raises an exception when debugging with PyCharm.

  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\miniwa\AppData\Local\Programs\PyCharm Professional\plugins\python\helpers\pydev\pydevd.py", line 1534, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\miniwa\AppData\Local\Programs\PyCharm Professional\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "main.py", line 2, in <module>
    from tianshou.data import Batch
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\__init__.py", line 1, in <module>
    from tianshou import data, env, exploration, policy, trainer, utils
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\data\__init__.py", line 21, in <module>
    from tianshou.data.collector import Collector, AsyncCollector
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\data\collector.py", line 19, in <module>
    from tianshou.env import BaseVectorEnv, DummyVectorEnv
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\env\__init__.py", line 9, in <module>
    from tianshou.env.venv_wrappers import VectorEnvNormObs, VectorEnvWrapper
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\env\venv_wrappers.py", line 6, in <module>
    from tianshou.env.venvs import GYM_RESERVED_KEYS, BaseVectorEnv
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\env\venvs.py", line 10, in <module>
    from tianshou.env.worker import (
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\env\worker\__init__.py", line 1, in <module>
    from tianshou.env.worker.base import EnvWorker
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\env\worker\base.py", line 8, in <module>
    from tianshou.utils import deprecation
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\utils\__init__.py", line 4, in <module>
    from tianshou.utils.logger.tensorboard import BasicLogger, TensorboardLogger
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tianshou\utils\logger\tensorboard.py", line 3, in <module>
    from tensorboard.backend.event_processing import event_accumulator
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\backend\event_processing\event_accumulator.py", line 24, in <module>
    from tensorboard.backend.event_processing import event_file_loader
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\backend\event_processing\event_file_loader.py", line 20, in <module>
    from tensorboard import data_compat
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\data_compat.py", line 26, in <module>
    from tensorboard.util import tensor_util
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\util\tensor_util.py", line 20, in <module>
    from tensorboard.compat.tensorflow_stub import dtypes, compat, tensor_shape
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\compat\tensorflow_stub\__init__.py", line 25, in <module>
    from . import app  # noqa
    ^^^^^^^^^^^^^^^^^
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\compat\tensorflow_stub\app.py", line 21, in <module>
    from . import flags
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\compat\tensorflow_stub\flags.py", line 123, in <module>
    FLAGS = _FlagValuesWrapper(FLAGS)  # pylint: disable=used-before-assignment
            ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "_pydevd_bundle\\pydevd_pep_669_tracing_cython.pyx", line 504, in _pydevd_bundle.pydevd_pep_669_tracing_cython.PyRaiseCallback.__call__
  File "_pydevd_bundle\\pydevd_pep_669_tracing_cython.pyx", line 47, in _pydevd_bundle.pydevd_pep_669_tracing_cython.PEP669CallbackBase.frame
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\compat\tensorflow_stub\flags.py", line 75, in __getattribute__
    return self.__dict__["__wrapped"].__getattribute__(name)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: '__wrapped'
python-BaseException
Traceback (most recent call last):
  File "C:\Users\miniwa\AppData\Local\Programs\PyCharm Professional\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_xml.py", line 177, in _get_type
    if isinstance(o, t[0]):
       ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\miniwa\AppData\Local\Programs\Python\Python312\Lib\site-packages\tensorboard\compat\tensorflow_stub\flags.py", line 75, in __getattribute__
    return self.__dict__["__wrapped"].__getattribute__(name)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: '__wrapped'

This may have been addressed in 6f4b7a1, which unfortunately is not in the latest release.

Could you try using tb-nightly instead of tensorboard and let us know if it resolves your issue?

Hi, thank you for the reply. Using tb-nightly sadly did not fix the issue. :)

@miniwa , just checking, did you uninstall TensorBoard before installing the nightly version?

Ah, another user reports in #6750 that it might be an issue with PyCharm, and updating PyCharm might solve the issue.

Ah, another user reports in #6750 that it might be an issue with PyCharm, and updating PyCharm might solve the issue.

Ooh I was not aware. I updated pycharm and that did indeed fix my issue. Thanks for the help.