HumanSignal / label-studio-ml-backend

Configs and boilerplates for Label Studio's Machine Learning backend
Apache License 2.0
587 stars 261 forks source link

ModuleNotFoundError: No module named 'label_studio_sdk.objects' #579

Closed rohinr7 closed 2 months ago

rohinr7 commented 4 months ago

I have trying to install ML backend latest but unfortunately I am getting error

Traceback (most recent call last):
  File "C:\Users\rohin\anaconda3\envs\labstd\Scripts\label-studio-ml-script.py", line 33, in <module>
    sys.exit(load_entry_point('label-studio-ml', 'console_scripts', 'label-studio-ml')())
  File "C:\Users\rohin\anaconda3\envs\labstd\Scripts\label-studio-ml-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "C:\Users\rohin\anaconda3\envs\labstd\lib\importlib\metadata\__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "C:\Users\rohin\anaconda3\envs\labstd\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "c:\users\rohin\label-studio-ml-backend\label_studio_ml\server.py", line 13, in <module>
    from .model import get_all_classes_inherited_LabelStudioMLBase
  File "c:\users\rohin\label-studio-ml-backend\label_studio_ml\model.py", line 29, in <module>
    from .response import ModelResponse
  File "c:\users\rohin\label-studio-ml-backend\label_studio_ml\response.py", line 5, in <module>
    from label_studio_sdk.objects import PredictionValue
ModuleNotFoundError: No module named 'label_studio_sdk.objects'``
rohinr7 commented 4 months ago

also i get

`Traceback (most recent call last):
  File "C:\Users\rohin\anaconda3\envs\camcl\Scripts\label-studio-ml-script.py", line 33, in <module>
    sys.exit(load_entry_point('label-studio-ml', 'console_scripts', 'label-studio-ml')())
  File "C:\Users\rohin\anaconda3\envs\camcl\Scripts\label-studio-ml-script.py", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "C:\Users\rohin\anaconda3\envs\camcl\lib\importlib\metadata\__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "C:\Users\rohin\anaconda3\envs\camcl\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "c:\users\rohin\label-studio-ml-backend\label_studio_ml\server.py", line 13, in <module>
    from .model import get_all_classes_inherited_LabelStudioMLBase
  File "c:\users\rohin\label-studio-ml-backend\label_studio_ml\model.py", line 26, in <module>
    from label_studio_sdk.label_interface import LabelInterface
  File "C:\Users\rohin\anaconda3\envs\camcl\lib\site-packages\label_studio_sdk\label_interface\__init__.py", line 1, in <module>
    from .interface import LabelInterface
  File "C:\Users\rohin\anaconda3\envs\camcl\lib\site-packages\label_studio_sdk\label_interface\interface.py", line 32, in <module>
    from .objects import AnnotationValue, TaskValue, PredictionValue
  File "C:\Users\rohin\anaconda3\envs\camcl\lib\site-packages\label_studio_sdk\label_interface\objects.py", line 2, in <module>
    from pydantic import BaseModel, Field, confloat, field_serializer
ImportError: cannot import name 'field_serializer' from 'pydantic' (C:\Users\rohin\anaconda3\envs\camcl\lib\site-packages\pydantic\__init__.cp310-win_amd64.pyd)`
GeorgeVJose commented 4 months ago

You can upgrade the pydantic as a short-term fix for the ImportError.

pip install --upgrade pydantic

I don't think this is a solution since it raises UserWarnings.

makseq commented 2 months ago

Please upgrade both label-studio-ml-backend and label-studio-sdk libs to the latest versions, it should be fixed.