cannot import name ‘_compare_version‘ from ‘torchmetrics.utilities.imports‘

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)

There are a few possible reasons for this error:

  • 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 or conda list torchmetrics and upgrade it if necessary with pip install --upgrade torchmetrics or conda 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 or conda install --force-reinstall torchmetrics pytorch_lightning.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值