Skip to content

Exception when debugging in pycharm #6750

@lostinplace

Description

@lostinplace

Environment information (required)

win amd64

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

### Diagnostics

<details>
<summary>Diagnostics output</summary>

--- check: autoidentify
INFO: diagnose_tensorboard.py version df7af2c6fc0e4c4a5b47aeae078bc7ad95777ffa

--- check: general
INFO: sys.version_info: sys.version_info(major=3, minor=12, micro=1, 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: 'C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12'

--- check: installed_packages
INFO: installed: tensorboard==2.15.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.15.2'

--- check: tensorflow_python_version
Traceback (most recent call last):
File "C:\code\GNOT\diagnose_tensorboard.py", line 511, in main
suggestions.extend(check())
^^^^^^^
File "C:\code\GNOT\diagnose_tensorboard.py", line 81, in wrapper
result = fn()
^^^^
File "C:\code\GNOT\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\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\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(): 'Box2'

--- check: stat_tensorboardinfo
INFO: directory: C:\Users\CMWhe\AppData\Local\Temp.tensorboard-info
INFO: .tensorboard-info directory does not exist

--- check: source_trees_without_genfiles
INFO: tensorboard_roots (1): ['C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages']; bad_roots (0): []

--- check: full_pip_freeze
INFO: pip freeze --all:
absl-py==2.1.0

cachetools==5.3.2

certifi==2024.2.2

charset-normalizer==3.3.2

colorama==0.4.6

contourpy==1.2.0

cycler==0.12.1

dgl @ file:///C:/code/GNOT/lib/dgl-2.1-cp312-cp312-win_amd64.whl

einops==0.7.0

filelock==3.13.1

fonttools==4.48.1

fsspec==2024.2.0

google-auth==2.27.0

google-auth-oauthlib==1.2.0

grpcio==1.60.1

idna==3.6

Jinja2==3.1.3

joblib==1.3.2

kiwisolver==1.4.5

Markdown==3.5.2

MarkupSafe==2.1.5

matplotlib==3.8.2

mpmath==1.3.0

networkx==3.2.1

numpy==1.26.4

oauthlib==3.2.2

packaging==23.2

pillow==10.2.0

pip==23.3.1

protobuf==4.25.2

psutil==5.9.8

pyasn1==0.5.1

pyasn1-modules==0.3.0

pyparsing==3.1.1

python-dateutil==2.8.2

requests==2.31.0

requests-oauthlib==1.3.1

rsa==4.9

scikit-learn==1.4.0

scipy==1.12.0

setuptools==69.1.0

six==1.16.0

sympy==1.12

tensorboard==2.15.2

tensorboard-data-server==0.7.2

threadpoolctl==3.2.0

torch==2.2.0

torchdata==0.7.1

tqdm==4.66.2

typing_extensions==4.9.0

urllib3==2.2.0

Werkzeug==3.0.1


</details>

### Next steps

No action items identified. Please copy ALL of the above output,
including the lines containing only backticks, into your GitHub issue
or comment. Be sure to redact any sensitive information.
```


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

when attempting to debug a script using tensorboard in pycharm, an exception is thrown preventing progress:

```
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\CMWhe\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\CMWhe\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 "C:\code\GNOT\train.py", line 18, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\torch\utils\tensorboard\__init__.py", line 12, in <module>
    from .writer import FileWriter, SummaryWriter  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\torch\utils\tensorboard\writer.py", line 15, in <module>
    from tensorboard.summary.writer.event_file_writer import EventFileWriter
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\tensorboard\summary\__init__.py", line 22, in <module>
    from tensorboard.summary import v1  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\tensorboard\summary\v1.py", line 23, in <module>
    from tensorboard.plugins.histogram import summary as _histogram_summary
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\tensorboard\plugins\histogram\summary.py", line 35, in <module>
    from tensorboard.plugins.histogram import summary_v2
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\tensorboard\plugins\histogram\summary_v2.py", line 35, in <module>
    from tensorboard.util import tensor_util
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\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\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\tensorboard\compat\tensorflow_stub\__init__.py", line 25, in <module>
    from . import app  # noqa
    ^^^^^^^^^^^^^^^^^
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\tensorboard\compat\tensorflow_stub\app.py", line 21, in <module>
    from . import flags
  File "C:\Users\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\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\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\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\CMWhe\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\CMWhe\AppData\Local\pypoetry\Cache\virtualenvs\gnot-cKTlZDKu-py3.12\Lib\site-packages\tensorboard\compat\tensorflow_stub\flags.py", line 75, in __getattribute__
    return self.__dict__["__wrapped"].__getattribute__(name)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: '__wrapped'
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions