Traceback (most recent call last):
File “/scratch/AzureNfsServer_INPUT1/vc_data/users/willing/home/mQG/src/1_train.py”, line 14, in
import pytorch_lightning as pl
File “/home/aiscuser/.conda/envs/willing/lib/python3.9/site-packages/pytorch_lightning/init.py”, line 34, in
from pytorch_lightning.callbacks import Callback # noqa: E402
File “/home/aiscuser/.conda/envs/willing/lib/python3.9/site-packages/pytorch_lightning/callbacks/init.py”, line 25, in
from pytorch_lightning.callbacks.progress import ProgressBarBase, RichProgressBar, TQDMProgressBar
File “/home/aiscuser/.conda/envs/willing/lib/python3.9/site-packages/pytorch_lightning/callbacks/progress/init.py”, line 22, in
from pytorch_lightning.callbacks.progress.rich_progress import RichProgressBar # noqa: F401
File “/home/aiscuser/.conda/envs/willing/lib/python3.9/site-packages/pytorch_lightning/callbacks/progress/rich_progress.py”, line 20, in
from torchmetrics.utilities.imports import _compare_version
ImportError: cannot import name ‘_compare_version’ from ‘torchmetrics.utilities.imports’ (/home/aiscuser/.conda/envs/willing/lib/python3.9/site-packages/torchmetrics/utilities/imports.py)文章来源:https://www.toymoban.com/news/detail-794061.html
There are a few possible reasons for this error:文章来源地址https://www.toymoban.com/news/detail-794061.html
- The version of torchmetrics installed is incompatible with the version of pytorch_lightning. According to the pytorch_lightning documentation, the minimum required version of torchmetrics is 0.4.1. You can check your installed version with
pip show torchmetrics
orconda list torchmetrics
and upgrade it if necessary withpip install --upgrade torchmetrics
orconda update torchmetrics
. - The installation of torchmetrics or pytorch_lightning is corrupted or incomplete. You can try reinstalling them with
pip install --force-reinstall torchmetrics pytorch_lightning
orconda install --force-reinstall torchmetrics pytorch_lightning
.
到了这里,关于cannot import name ‘_compare_version‘ from ‘torchmetrics.utilities.imports‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!