HumanSignal / HumanSignal/label-studio-ml-backend

ModuleNotFoundError: No module named 'resource'

Open
#298 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
490
Avg merge
1d 14h
Merged PRs (30d)
3

Description

when I start my custom ML backend with Label Studio with a problem:
it show this:

This is my input code:
**(label_sam) E:\ProgramData\Anaconda3_projects\playground\label_anything\require_packages\label-studio-ml-
backend>label-studio-ml init sam --script E:\ProgramData\Anaconda3_projects\playground\label_anything\req
uire_packages\label-studio-ml-backend\label_studio_ml\examples\segment_anything_model\segment_anything_model.py**

This is an error report:
Traceback (most recent call last):
File "E:\ProgramData\Anaconda3\envs\label_sam\Scripts\label-studio-ml-script.py", line 33, in
sys.exit(load_entry_point('label-studio-ml', 'console_scripts', 'label-studio-ml')())
File "E:\ProgramData\Anaconda3\envs\label_sam\Scripts\label-studio-ml-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\importlib\metadata.py", line 86, in load
module = import_module(match.group('module'))
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "e:\programdata\anaconda3_projects\playground\label_anything\require_packages\label-studio-ml-backend\label_studio_ml\server.py", line 13, in
from .model import get_all_classes_inherited_LabelStudioMLBase
File "e:\programdata\anaconda3_projects\playground\label_anything\require_packages\label-studio-ml-backend\label_studio_ml\model.py", line 9, in
import rq
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\site-packages\rq\__init__.py", line 7, in
from .worker import SimpleWorker, Worker
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\site-packages\rq\worker.py", line 6, in
import resource
ModuleNotFoundError: No module named 'resource'

When I found this file and placed it in the virtual environment's lib, it reported an error:
Traceback (most recent call last):
File "E:\ProgramData\Anaconda3\envs\label_sam\Scripts\label-studio-ml-script.py", line 33, in
sys.exit(load_entry_point('label-studio-ml', 'console_scripts', 'label-studio-ml')())
File "E:\ProgramData\Anaconda3\envs\label_sam\Scripts\label-studio-ml-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\importlib\metadata.py", line 86, in load
module = import_module(match.group('module'))
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "e:\programdata\anaconda3_projects\playground\label_anything\require_packages\label-studio-ml-backend\label_studio_ml\server.py", line 13, in
from .model import get_all_classes_inherited_LabelStudioMLBase
File "e:\programdata\anaconda3_projects\playground\label_anything\require_packages\label-studio-ml-backend\label_studio_ml\model.py", line 9, in
import rq
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\site-packages\rq\__init__.py", line 7, in
from .worker import SimpleWorker, Worker
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\site-packages\rq\worker.py", line 6, in
import resource
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\resource.py", line 28, in
class struct_rusage(_Tuple16):
File "E:\ProgramData\Anaconda3\envs\label_sam\lib\resource.py", line 29, in struct_rusage
def __new__(cls, sequence: _Tuple16, dict: dict[str, Any] = ...) -> struct_rusage: ...
NameError: name 'struct_rusage' is not defined

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Windows/Anaconda command and trace the import path through label_studio_ml/server.py, label_studio_ml/model.py, and rq/worker.py. Compare the initial missing-resource error with the later failure from lib/resource.py; done means establishing a confirmed resolution for the custom backend startup failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.