tnpp_parse fails with import error
harrikoo opened this issue · 1 comments
harrikoo commented
When I install the parser as instructed on basic documentation and try to run the fir st example,
echo "Minulla on koira." | python3 tnpp_parse.py --conf models_fi_tdt_dia/pipelines.yaml parse_plaintext
tnpp_parse.py
crashes with message:
Traceback (most recent call last):
File "tnpp_parse.py", line 68, in <module>
p=Pipeline(steps=pipeline, extra_args=args)
File "[...]/Turku-neural-parser-pipeline/tnparser/pipeline.py", line 35, in __init__
self.add_step(mod_name_and_params, extra_args)
File "[...]/Turku-neural-parser-pipeline/tnparser/pipeline.py", line 84, in add_step
mod=importlib.import_module("tnparser."+module_name)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "[...]/Turku-neural-parser-pipeline/tnparser/lightning_tagger_mod.py", line 3, in <module>
import pytorch_lightning as pl
File "[...]/Turku-neural-parser-pipeline/venv-tnpp/lib/python3.8/site-packages/pytorch_lightning/__init__.py", line 20, in <module>
from pytorch_lightning import metrics # noqa: E402
File "[...]/Turku-neural-parser-pipeline/venv-tnpp/lib/python3.8/site-packages/pytorch_lightning/metrics/__init__.py", line 15, in <module>
from pytorch_lightning.metrics.classification import ( # noqa: F401
File "[...]/Turku-neural-parser-pipeline/venv-tnpp/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/__init__.py", line 14, in <module>
from pytorch_lightning.metrics.classification.accuracy import Accuracy # noqa: F401
File "[...]/Turku-neural-parser-pipeline/venv-tnpp/lib/python3.8/site-packages/pytorch_lightning/metrics/classification/accuracy.py", line 18, in <module>
from pytorch_lightning.metrics.utils import deprecated_metrics, void
File "[...]/Turku-neural-parser-pipeline/venv-tnpp/lib/python3.8/site-packages/pytorch_lightning/metrics/utils.py", line 22, in <module>
from torchmetrics.utilities.data import get_num_classes as _get_num_classes
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' ([...]/Turku-neural-parser-pipeline/venv-tnpp/lib/python3.8/site-packages/torchmetrics/utilities/data.py)
```