尝试运行 tensorboard(对于 pytorch,在 windows 上)导致 AttributeError: type object 'h5py.h5.H5PYConfig' has no a

Posted

技术标签:

【中文标题】尝试运行 tensorboard(对于 pytorch,在 windows 上)导致 AttributeError: type object \'h5py.h5.H5PYConfig\' has no attribute \'__reduce_cython__\'【英文标题】:trying to run tensorboard (for pytorch, on windows) results in AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'尝试运行 tensorboard(对于 pytorch,在 windows 上)导致 AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__' 【发布时间】:2021-12-22 01:00:34 【问题描述】:

看起来可能是构建问题,但在我从头开始构建环境后仍然会出现。

重要提示:我在windows环境下工作,不是使用tensorflow,而是pytorch和tensorboard。

我尝试了 conda install h5py 但 conda 列表仍然显示旧版本。

这是 conda 列表输出

# packages in environment at D:\ProgramData\Anaconda3\envs\env_new:
#
# Name                    Version                   Build  Channel
absl-py                   0.15.0             pyhd8ed1ab_0    conda-forge
aiohttp                   3.7.4.post0      py38h294d835_1    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
async-timeout             3.0.1            py38haa95532_0
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
blas                      1.0                         mkl
blinker                   1.4                        py_1    conda-forge
brotlipy                  0.7.0           py38h294d835_1003    conda-forge
ca-certificates           2020.10.14                    0    anaconda
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cachetools                4.2.4              pyhd8ed1ab_0    conda-forge
certifi                   2020.6.20                py38_0    anaconda
cffi                      1.15.0           py38hd8c33c5_0    conda-forge
chardet                   4.0.0            py38haa244fe_2    conda-forge
charset-normalizer        2.0.0              pyhd8ed1ab_0    conda-forge
click                     8.0.3            py38haa244fe_1    conda-forge
cloudpickle               2.0.0              pyhd8ed1ab_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
coverage                  6.1.1            py38h294d835_1    conda-forge
cryptography              35.0.0           py38hb7941b4_2    conda-forge
cudatoolkit               10.2.89              hb195166_9    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cython                    0.29.24          py38h885f38d_1    conda-forge
cytoolz                   0.11.2           py38h294d835_1    conda-forge
dask-core                 2021.11.0          pyhd8ed1ab_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
dill                      0.3.2                      py_0    anaconda
enum34                    1.1.10           py38h32f6830_2    conda-forge
filelock                  3.3.2              pyhd8ed1ab_0    conda-forge
freetype                  2.10.4               hd328e21_0
fsspec                    2021.11.0          pyhd8ed1ab_0    conda-forge
geos                      3.10.0               h39d44d4_0    conda-forge
google-auth               1.35.0             pyh6c4a22f_0    conda-forge
google-auth-oauthlib      0.4.6              pyhd8ed1ab_0    conda-forge
grpcio                    1.36.1           py38hc60d5dd_1
h5py                      2.10.0           py38h5e291fa_0    anaconda
hdf5                      1.10.4          nompi_hcc15c50_1106    conda-forge
huggingface_hub           0.1.1              pyhd8ed1ab_0    conda-forge
icc_rt                    2019.0.0             h0cc432a_1    anaconda
icu                       58.2             vc14hc45fdbb_0  [vc14]  anaconda
idna                      3.1                pyhd3deb0d_0    conda-forge
imagecodecs-lite          2019.12.3        py38h347fdf6_3    conda-forge
imageio                   2.9.0                      py_0    conda-forge
imgaug                    0.4.0                      py_1    conda-forge
importlib-metadata        4.8.1            py38haa244fe_1    conda-forge
importlib_metadata        4.8.1                hd8ed1ab_1    conda-forge
intel-openmp              2021.4.0          haa95532_3556
joblib                    0.17.0                     py_0    anaconda
jpeg                      9b               vc14h4d7706e_1  [vc14]  anaconda
kiwisolver                1.3.2            py38hbd9d945_1    conda-forge
krb5                      1.19.2               h20d022d_3    conda-forge
libcurl                   7.79.1               h789b8ee_1    conda-forge
libopencv                 4.0.1                hbb9e17c_0
libpng                    1.6.37               h2a8f88b_0
libprotobuf               3.17.2               h23ce68f_1
libssh2                   1.10.0               h680486a_2    conda-forge
libtiff                   4.2.0                hd0e1b90_0
libuv                     1.40.0               he774522_0
libwebp                   1.2.0                h2bbff1b_0
locket                    0.2.0                      py_2    conda-forge
lz4-c                     1.9.3                h2bbff1b_1
markdown                  3.3.4              pyhd8ed1ab_0    conda-forge
matplotlib                3.4.3            py38haa244fe_1    conda-forge
matplotlib-base           3.4.3            py38h1f000d6_1    conda-forge
mkl                       2021.4.0           haa95532_640
mkl-service               2.4.0            py38h2bbff1b_0
mkl_fft                   1.3.1            py38h277e83a_0
mkl_random                1.2.2            py38hf11a4ad_0
multicore-tsne            0.1_d4ff4aab     py38h2f20550_1    conda-forge
multidict                 5.2.0            py38h294d835_1    conda-forge
networkx                  2.6.3              pyhd8ed1ab_1    conda-forge
nibabel                   3.2.1              pyhd8ed1ab_0    conda-forge
numpy                     1.21.2           py38hfca59bb_0
numpy-base                1.21.2           py38h0829f74_0
oauthlib                  3.1.1              pyhd8ed1ab_0    conda-forge
olefile                   0.46               pyhd3eb1b0_0
opencv                    4.0.1            py38h2a7c758_0
openssl                   1.1.1l               h2bbff1b_0
packaging                 21.0               pyhd8ed1ab_0    conda-forge
pandas                    1.1.3            py38ha925a31_0    anaconda
partd                     1.2.0              pyhd8ed1ab_0    conda-forge
pathlib                   1.0.1            py38haa244fe_5    conda-forge
pillow                    8.4.0            py38hd45dc43_0
pip                       20.2.4                   py38_0    anaconda
pooch                     1.5.2              pyhd8ed1ab_0    conda-forge
protobuf                  3.17.2           py38hd77b12b_0
py-opencv                 4.0.1            py38he44ac1e_0
pyasn1                    0.4.8                      py_0    conda-forge
pyasn1-modules            0.2.7                      py_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydicom                   2.2.2              pyh6c4a22f_0    conda-forge
pyjwt                     2.3.0              pyhd8ed1ab_0    conda-forge
pyopenssl                 21.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.5              pyhd8ed1ab_0    conda-forge
pyqt                      5.9.2            py38ha925a31_4    anaconda
pyreadline                2.1             py38haa244fe_1005    conda-forge
pysocks                   1.7.1            py38haa244fe_4    conda-forge
python                    3.8.5                h5fd99cc_1    anaconda
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.8                      2_cp38    conda-forge
pytorch                   1.10.0          py3.8_cuda10.2_cudnn7_0    pytorch
pytorch-metric-learning   0.9.99             pyh39e3cac_0    metric-learning
pytorch-mutex             1.0                        cuda    pytorch
pytz                      2020.1                     py_0    anaconda
pyu2f                     0.1.5              pyhd8ed1ab_0    conda-forge
pywavelets                1.1.1            py38h6f4d8f0_4    conda-forge
pyyaml                    3.13             py38hfa6e2cd_0    conda-forge
qt                        5.9.7            vc14h73c81de_0  [vc14]  anaconda
regex                     2021.11.2        py38h294d835_0    conda-forge
requests                  2.26.0             pyhd8ed1ab_0    conda-forge
requests-oauthlib         1.3.0              pyh9f0ad1d_0    conda-forge
rsa                       4.7.2              pyh44b312d_0    conda-forge
sacremoses                0.0.46             pyhd8ed1ab_0    conda-forge
scikit-image              0.18.3           py38h5d928e2_0    conda-forge
scikit-learn              0.23.2           py38h47e9c7a_0    anaconda
scipy                     1.7.1            py38hbe87c03_2
setuptools                50.3.0           py38h9490d1a_1    anaconda
shapely                   1.8.0            py38he21f6c5_1    conda-forge
sip                       4.19.25          py38h885f38d_1    conda-forge
six                       1.16.0             pyhd3eb1b0_0
sqlite                    3.33.0               h2a8f88b_0    anaconda
tensorboard               2.6.0              pyhd8ed1ab_1    conda-forge
tensorboard-data-server   0.6.0            py38haa244fe_1    conda-forge
tensorboard-plugin-wit    1.8.0              pyh44b312d_0    conda-forge
threadpoolctl             2.1.0              pyh5ca1d4c_0    anaconda
tifffile                  2019.7.26.2              py38_0    conda-forge
tk                        8.6.11               h2bbff1b_0
tokenizers                0.10.3           py38h291c280_1    conda-forge
tomli                     1.2.2              pyhd8ed1ab_0    conda-forge
toolz                     0.11.2             pyhd8ed1ab_0    conda-forge
torchaudio                0.10.0               py38_cu102    pytorch
torchvision               0.11.1               py38_cu102    pytorch
tornado                   6.1              py38h294d835_2    conda-forge
tqdm                      4.62.3             pyhd8ed1ab_0    conda-forge
transformers              4.12.3             pyhd8ed1ab_0    conda-forge
typing-extensions         3.10.0.2             hd3eb1b0_0
typing_extensions         3.10.0.2           pyh06a4308_0
urllib3                   1.26.7             pyhd8ed1ab_0    conda-forge
vc                        14.1                 h0510ff6_4    anaconda
vs2015_runtime            14.16.27012          hf0eaf9b_3    anaconda
werkzeug                  2.0.1              pyhd8ed1ab_0    conda-forge
wheel                     0.35.1                     py_0    anaconda
win_inet_pton             1.1.0            py38haa244fe_3    conda-forge
wincertstore              0.2                      py38_0    anaconda
xz                        5.2.5                h62dcd97_0
yaml                      0.1.7            vc14h4cb57cf_1  [vc14]  anaconda
yarl                      1.7.2            py38h294d835_1    conda-forge
zipp                      3.6.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11           vc14h1cdd9ab_1  [vc14]  anaconda
zstd                      1.4.9                h19a0ad4_0

和堆栈跟踪:

Traceback (most recent call last):
  File "<input>", line 3, in <module>
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/ProgramData/Anaconda3/envs/env_zoo/Lib/site-packages/tensorboard/main.py", line 40, in <module>
    from tensorboard import default
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorboard\default.py", line 39, in <module>
    from tensorboard.plugins.beholder import beholder_plugin_loader
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorboard\plugins\beholder\__init__.py", line 18, in <module>
    import tensorflow
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python.feature_column import feature_column_lib as feature_column
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\feature_column\feature_column_lib.py", line 22, in <module>
    from tensorflow.python.feature_column.feature_column import *
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\feature_column\feature_column.py", line 147, in <module>
    from tensorflow.python.layers import base
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\layers\base.py", line 20, in <module>
    from tensorflow.python.keras.legacy_tf_layers import base
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\__init__.py", line 25, in <module>
    from tensorflow.python.keras import models
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\models.py", line 20, in <module>
    from tensorflow.python.keras import metrics as metrics_module
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\metrics.py", line 34, in <module>
    from tensorflow.python.keras import activations
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\activations.py", line 18, in <module>
    from tensorflow.python.keras.layers import advanced_activations
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\layers\__init__.py", line 29, in <module>
    from tensorflow.python.keras.layers.preprocessing.image_preprocessing import CenterCrop
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\layers\preprocessing\image_preprocessing.py", line 29, in <module>
    from tensorflow.python.keras.preprocessing import image as image_preprocessing
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\preprocessing\__init__.py", line 26, in <module>
    from tensorflow.python.keras.utils import all_utils as utils
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\utils\all_utils.py", line 34, in <module>
    from tensorflow.python.keras.utils.multi_gpu_utils import multi_gpu_model
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\utils\multi_gpu_utils.py", line 19, in <module>
    from tensorflow.python.keras.engine.training import Model
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\engine\training.py", line 53, in <module>
    from tensorflow.python.keras.saving import save
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\tensorflow\python\keras\saving\save.py", line 30, in <module>
    import h5py
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\h5py\__init__.py", line 34, in <module>
    from . import version
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\envs\env_zoo\lib\site-packages\h5py\version.py", line 17, in <module>
    from . import h5 as _h5
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "h5py\h5.pyx", line 41, in init h5py.h5
AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'

我只尝试启动 tensorboard 并收到此消息。

如果我发布问题的方式有问题,请提供建设性反馈。

【问题讨论】:

有什么特别的理由要从头开始构建它吗? 我怀疑存在依赖问题,所以我创建了一个新的 conda env 并尝试通过单独安装每个包来查明有问题的包。它没有解决问题。 【参考方案1】:

Tensorboard 现在是 pytorch 本身的一部分(link)

只需导入以下内容

from torch.utils.tensorboard import SummaryWriter

对于要在tensorboard上跟踪的变量,在代码中添加以下内容

var = <value_you_want_to_track>
writer.add_scalar('<variable_name>',var,epoch)

一旦你在代码中定义了你的张量板变量,在你的 main.py 中,你可以编写以下内容

writer = SummaryWriter(path_of_runs_folder)

编辑 1:由于 OP 想要一种在不处理单个依赖项的情况下安装 tensorboard 的方法,因此我创建了 YAML 文件,您可以在您的机器中使用它来设置环境。

将以下代码块保存为 env.yml

name: pytorch_tensorboard
channels:
  - pytorch
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=4.5=1_gnu
  - absl-py=0.15.0=pyhd8ed1ab_0
  - aiohttp=3.7.4.post0=py38h497a2fe_0
  - async-timeout=3.0.1=py38h06a4308_0
  - attrs=21.2.0=pyhd8ed1ab_0
  - blas=1.0=mkl
  - blinker=1.4=py_1
  - brotlipy=0.7.0=py38h497a2fe_1001
  - bzip2=1.0.8=h7b6447c_0
  - c-ares=1.17.1=h27cfd23_0
  - ca-certificates=2021.10.8=ha878542_0
  - cachetools=4.2.4=pyhd8ed1ab_0
  - certifi=2021.10.8=py38h578d9bd_1
  - cffi=1.14.6=py38h400218f_0
  - chardet=4.0.0=py38h578d9bd_2
  - charset-normalizer=2.0.0=pyhd8ed1ab_0
  - click=8.0.3=py38h578d9bd_1
  - cryptography=35.0.0=py38ha5dfef3_0
  - cudatoolkit=10.2.89=hfd86e86_1
  - dataclasses=0.8=pyhc8e2a94_3
  - ffmpeg=4.3=hf484d3e_0
  - freetype=2.11.0=h70c0345_0
  - giflib=5.2.1=h7b6447c_0
  - gmp=6.2.1=h2531618_2
  - gnutls=3.6.15=he1e5248_0
  - google-auth=1.35.0=pyh6c4a22f_0
  - google-auth-oauthlib=0.4.6=pyhd8ed1ab_0
  - grpcio=1.37.1=py38hdd6454d_0
  - idna=3.1=pyhd3deb0d_0
  - importlib-metadata=4.8.2=py38h578d9bd_0
  - intel-openmp=2021.4.0=h06a4308_3561
  - jpeg=9d=h7f8727e_0
  - lame=3.100=h7b6447c_0
  - lcms2=2.12=h3be6417_0
  - ld_impl_linux-64=2.35.1=h7274673_9
  - libffi=3.3=he6710b0_2
  - libgcc-ng=9.3.0=h5101ec6_17
  - libgomp=9.3.0=h5101ec6_17
  - libiconv=1.15=h63c8f33_5
  - libidn2=2.3.2=h7f8727e_0
  - libpng=1.6.37=hbc83047_0
  - libprotobuf=3.15.8=h780b84a_0
  - libstdcxx-ng=9.3.0=hd4cf53a_17
  - libtasn1=4.16.0=h27cfd23_0
  - libtiff=4.2.0=h85742a9_0
  - libunistring=0.9.10=h27cfd23_0
  - libuv=1.40.0=h7b6447c_0
  - libwebp=1.2.0=h89dd481_0
  - libwebp-base=1.2.0=h27cfd23_0
  - lz4-c=1.9.3=h295c915_1
  - markdown=3.3.4=pyhd8ed1ab_0
  - mkl=2021.4.0=h06a4308_640
  - mkl-service=2.4.0=py38h7f8727e_0
  - mkl_fft=1.3.1=py38hd3c417c_0
  - mkl_random=1.2.2=py38h51133e4_0
  - multidict=5.1.0=py38h27cfd23_2
  - ncurses=6.3=heee7806_1
  - nettle=3.7.3=hbbd107a_1
  - numpy=1.21.2=py38h20f2e39_0
  - numpy-base=1.21.2=py38h79a1101_0
  - oauthlib=3.1.1=pyhd8ed1ab_0
  - olefile=0.46=pyhd3eb1b0_0
  - openh264=2.1.0=hd408876_0
  - openssl=1.1.1l=h7f8727e_0
  - pillow=8.4.0=py38h5aabda8_0
  - pip=21.2.4=py38h06a4308_0
  - protobuf=3.15.8=py38h709712a_0
  - pyasn1=0.4.8=py_0
  - pyasn1-modules=0.2.7=py_0
  - pycparser=2.21=pyhd8ed1ab_0
  - pyjwt=2.3.0=pyhd8ed1ab_0
  - pyopenssl=21.0.0=pyhd8ed1ab_0
  - pysocks=1.7.1=py38h578d9bd_4
  - python=3.8.5=h7579374_1
  - python_abi=3.8=2_cp38
  - pytorch=1.10.0=py3.8_cuda10.2_cudnn7.6.5_0
  - pytorch-mutex=1.0=cuda
  - pyu2f=0.1.5=pyhd8ed1ab_0
  - readline=8.1=h27cfd23_0
  - requests=2.26.0=pyhd8ed1ab_0
  - requests-oauthlib=1.3.0=pyh9f0ad1d_0
  - rsa=4.7.2=pyh44b312d_0
  - setuptools=58.0.4=py38h06a4308_0
  - six=1.16.0=pyhd3eb1b0_0
  - sqlite=3.36.0=hc218d9a_0
  - tensorboard=2.6.0=pyhd8ed1ab_1
  - tensorboard-data-server=0.6.0=py38h2b97feb_0
  - tensorboard-plugin-wit=1.8.0=pyh44b312d_0
  - tk=8.6.11=h1ccaba5_0
  - torchaudio=0.10.0=py38_cu102
  - torchvision=0.11.1=py38_cu102
  - typing-extensions=3.10.0.2=hd3eb1b0_0
  - typing_extensions=3.10.0.2=pyh06a4308_0
  - tzdata=2021e=hda174b7_0
  - urllib3=1.26.7=pyhd8ed1ab_0
  - werkzeug=2.0.1=pyhd8ed1ab_0
  - wheel=0.37.0=pyhd3eb1b0_1
  - xz=5.2.5=h7b6447c_0
  - yarl=1.6.3=py38h497a2fe_2
  - zipp=3.6.0=pyhd8ed1ab_0
  - zlib=1.2.11=h7b6447c_3
  - zstd=1.4.9=haebb681_0

现在在您保存上述文件的目录中运行以下命令

conda env create --file env.yml

这会将带有 cuda、Python 3.8.5 和 Tensorboard 的 Pytorch 1.10 设置到环境中,您无需为每个依赖项手动执行此操作。

环境将以“pytorch_tensorboard”的名称创建。您可以通过修改 env.yml 的第一行来更改它

【讨论】:

这不能回答我的问题。在 pytorch tensorboard 教程中,显示​​您仍然需要安装 tensorboard。当我尝试从 tensorboard 包运行“main”时收到的错误消息。 @enter_thevoid 查看编辑 1。执行这些步骤可以解决您的问题。了解一下 无法使用您发送的 yml 文件,出现 ResolvePackageNotFound 错误。 您能显示错误吗,根据错误及其版本,您这边没有哪些软件包可用 啊,是的(github.com/conda/conda/issues/7311#issuecomment-442320274),我的是linux,你的是windows,导出可能会因此失败。让我在 windows 中创建类似的环境并更新答案

以上是关于尝试运行 tensorboard(对于 pytorch,在 windows 上)导致 AttributeError: type object 'h5py.h5.H5PYConfig' has no a的主要内容,如果未能解决你的问题,请参考以下文章

尝试重用已终止的 Windows PID 时如何重置 Tensorboard

尝试将 tensorboard 与 google colab 一起使用时出错

tensorflow tensorboard 摘要示例

通过 pip 安装后的 Tensorboard 错误

TensorBoard:将两张图合并为一张图

Tensorboard返回的网址打不开问题