doccano 解决 pydantic.errors.PydanticImportError: `pydantic:ConstrainedStr` has been removed in V2.

文章目录

    • 报错信息
    • 环境
    • 描述
    • 解决措施
      • 其他
    • doccano上传文件一直转圈圈

报错信息

  File "C:\Users\anaconda3\envs\UIE\lib\site-packages\pydantic\_migration.py", line 285, in wrapper
    raise PydanticImportError(f'`{import_path}` has been removed in V2.')
pydantic.errors.PydanticImportError: `pydantic:ConstrainedStr` has been removed in V2.

For further information visit https://errors.pydantic.dev/2.0.2/u/import-error

...

  File "C:\Users\anaconda3\envs\UIE\lib\site-packages\backend\data_import\datasets.py", line 12, in 
    from .pipeline.label import CategoryLabel, Label, RelationLabel, SpanLabel, TextLabel
  File "C:\Users\anaconda3\envs\UIE\lib\site-packages\backend\data_import\pipeline\label.py", line 5, in 
    from pydantic import UUID4, BaseModel, ConstrainedStr, NonNegativeInt, root_validator
  File "C:\Users\anaconda3\envs\UIE\lib\site-packages\pydantic\__init__.py", line 206, in __getattr__
    return _getattr_migration(attr_name)
  File "C:\Users\anaconda3\envs\UIE\lib\site-packages\pydantic\_migration.py", line 285, in wrapper
    raise PydanticImportError(f'`{import_path}` has been removed in V2.')
pydantic.errors.PydanticImportError: `pydantic:ConstrainedStr` has been removed in V2.

For further information visit https://errors.pydantic.dev/2.0.2/u/import-erro

网页也无法打开

Internal Server Error

The server encountered an unexpected internal server error

(generated by waitress)

doccano 解决 pydantic.errors.PydanticImportError: `pydantic:ConstrainedStr` has been removed in V2._第1张图片

环境

python3.9, python3.10 都支持
本人使用的是 doccano==1.8.3

描述

以前可以使用 doccano没有任何问题。
直到本人重新安装python 或者 创建新的python环境后,便无法使用 doccano
因为 doccano 将配置信息写在用户文件夹下的 doccano文件夹内,删去该文件夹,删去以前的配置信息;

同时还有下述错误:

  1. doccano 的webserver 网页打不开
  2. doccano 导出的数据集没有标注数据

解决措施

  1. 删除用户目录下的 doccano文件夹,重新执行 doccano init
    doccano 解决 pydantic.errors.PydanticImportError: `pydantic:ConstrainedStr` has been removed in V2._第2张图片

  2. pip install pydantic==1.10.11

  3. 如果执行上述步骤,仍不能解决此问题,可尝试降低 doccano版本: pip install doccano==1.6.2

其他

doccano上传文件一直转圈圈

在另一个命令窗口执行: doccano task

你可能感兴趣的:(调bug,自然语言处理)