kazuto1011 / deeplab-pytorch

PyTorch re-implementation of DeepLab v2 on COCO-Stuff / PASCAL VOC datasets
MIT License
1.09k stars 282 forks source link

Training Deeplab-pytorch on VOC2012 raises metaclass conflict error with TensorFlow 1.10.0 and ANTLR downgrade to 4.8 #116

Open Linn0910 opened 8 months ago

Linn0910 commented 8 months ago

I am attempting to train VOC2012 using your deeplab-pytorch project on Ubuntu 22.04 with Python version 3.6. However, I encountered an issue when running the following command:


(deeplab-pytorch) root@rtx6:/workspace/projects/CLIP-ES/deeplab-pytorch# python main.py train --config-path configs/voc12.yaml

The specific error message is as follows:
Traceback (most recent call last):
  File "main.py", line 22, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/torch/utils/tensorboard/__init__.py", line 13, in <module>
    from .writer import FileWriter, SummaryWriter  # noqa: F401
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/torch/utils/tensorboard/writer.py", line 13, in <module>
    from tensorboard.summary.writer.event_file_writer import EventFileWriter
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/summary/__init__.py", line 22, in <module>
    from tensorboard.summary import v1  # noqa: F401
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/summary/v1.py", line 23, in <module>
    from tensorboard.plugins.histogram import summary as _histogram_summary
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/plugins/histogram/summary.py", line 35, in <module>
    from tensorboard.plugins.histogram import summary_v2
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/plugins/histogram/summary_v2.py", line 35, in <module>
    from tensorboard.util import tensor_util
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/util/tensor_util.py", line 20, in <module>
    from tensorboard.compat.tensorflow_stub import dtypes, compat, tensor_shape
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/__init__.py", line 25, in <module>
    from . import app  # noqa
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/app.py", line 21, in <module>
    from . import flags
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/flags.py", line 25, in <module>
    from absl.flags import *  # pylint: disable=wildcard-import
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/absl/flags/__init__.py", line 35, in <module>
    from absl.flags import _argument_parser
  File "/workspace/tools/conda/envs/deeplab-pytorch/lib/python3.6/site-packages/absl/flags/_argument_parser.py", line 82, in <module>
    class ArgumentParser(Generic[_T], metaclass=_ArgumentParserCache):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Environment Information:

Operating System: Ubuntu 22.04
Python Version: 3.6
TensorFlow Version: 1.10.0
Other Key Dependency Versions: 
Package                 Version
----------------------- ------------
absl-py                 2.0.0
addict                  2.4.0
antlr4-python3-runtime  4.8
astor                   0.8.1
black                   22.6.0
cachetools              4.2.4
certifi                 2021.5.30
cffi                    1.14.6
charset-normalizer      2.0.12
click                   8.0.4
colorama                0.4.5
cycler                  0.11.0
dataclasses             0.8
future                  0.18.2
gast                    0.5.4
google-auth             2.22.0
google-auth-oauthlib    0.4.6
grpcio                  1.38.1
idna                    3.6
importlib-metadata      4.8.3
joblib                  1.2.0
kiwisolver              1.3.1
Markdown                3.5.2
matplotlib              3.3.4
mypy-extensions         1.0.0
numpy                   1.19.5
oauthlib                3.2.2
olefile                 0.46
omegaconf               2.3.0
pathspec                0.9.0
Pillow                  8.3.2
pip                     21.3.1
platformdirs            2.5.1
protobuf                3.16.0
pyasn1                  0.5.1
pyasn1-modules          0.3.0
pycparser               2.21
pydensecrf              1.0rc3
pyparsing               3.1.1
PyQt5                   5.12.3
PyQt5_sip               4.19.18
PyQtChart               5.12
PyQtWebEngine           5.12.1
python-dateutil         2.8.2
PyYAML                  5.4.1
requests                2.27.1
requests-oauthlib       1.3.1
rsa                     4.9
scipy                   1.5.3
setuptools              58.0.4
six                     1.16.0
tensorboard             2.10.1
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.1
tensorflow              1.10.0
termcolor               1.1.0
tomli                   1.2.2
torch                   1.9.0+cu102
torchaudio              0.9.0
torchvision             0.10.0+cu102
tornado                 6.1
tqdm                    4.65.0
typed-ast               1.4.3
typing_extensions       4.1.1
urllib3                 1.26.18
Werkzeug                2.0.2
wheel                   0.37.1
zipp                    3.6.0

Attempted Solutions:
I have tried the following solutions:
 Downgraded ANTLR version from 4.13 to 4.8.  And before this, in ANTLR 4.13 I met a error :
raise Exception("Could not deserialize ATN with version " + str(version) + " (expected " + str(SERIALIZED_VERSION) + ").")
Exception: Could not deserialize ATN with version  (expected 4).

So I tried to downgrade ANTLR ,and I met the error above(AugmentParser)

Thank you very much for your assistance!