今天在安装label-studio之后,启动label-studio之后报错,根据提示安装ruamel,发现找不到这个包,我的环境是:

  • Mac
  • python 3.7

错误信息为:

➜  ernie_vil label-studio
=> Database and media directory: /Users/../Library/Application Support/label-studio
=> Static URL is set to: /static/
=> Database and media directory: /Users/../Library/Application Support/label-studio
=> Static URL is set to: /static/
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /pypi/label-studio/json HTTP/1.1" 200 55841
NumExpr defaulting to 8 threads.
Initializing database..
Performing system checks...

Traceback (most recent call last):
File "/Users/../anaconda3/bin/label-studio", line 8, in <module>
sys.exit(main())
File "/Users/../anaconda3/lib/python3.7/site-packages/label_studio/server.py", line 423, in main
_app_run(host=internal_host, port=internal_port)
File "/Users/../anaconda3/lib/python3.7/site-packages/label_studio/server.py", line 45, in _app_run
call_command('runserver', '--noreload', http_socket)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/management/__init__.py", line 181, in call_command
return command.execute(*args, **defaults)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super().execute(*args, **options)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 96, in handle
self.run(**options)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 105, in run
self.inner_run(None, **options)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/management/base.py", line 423, in check
databases=databases,
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/Users/../anaconda3/lib/python3.7/site-packages/django/urls/resolvers.py", line 416, in check
for pattern in self.url_patterns:
File "/Users/../anaconda3/lib/python3.7/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/urls/resolvers.py", line 602, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/../anaconda3/lib/python3.7/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
return import_module(self.urlconf_name)
File "/Users/../anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/../anaconda3/lib/python3.7/site-packages/label_studio/core/urls.py", line 26, in <module>
from drf_yasg.views import get_schema_view
File "/Users/../anaconda3/lib/python3.7/site-packages/drf_yasg/views.py", line 13, in <module>
from .renderers import (
File "/Users/../anaconda3/lib/python3.7/site-packages/drf_yasg/renderers.py", line 9, in <module>
from .codecs import VALIDATORS, OpenAPICodecJson, OpenAPICodecYaml
File "/Users/../anaconda3/lib/python3.7/site-packages/drf_yasg/codecs.py", line 7, in <module>
from ruamel import yaml
ModuleNotFoundError: No module named 'ruamel'
➜ ernie_vil pip install ruamel
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
ERROR: Could not find a version that satisfies the requirement ruamel (from versions: none)
ERROR: No matching distribution found for ruamel

解决方法

conda install ruamel.yaml

用anaconda安装就可以了,重新启动也没问题。

参考文献

​Launching label-studio causes error - No module named ‘ruamel’​