HumanSignal / label-studio

Label Studio is a multi-type data labeling and annotation tool with standardized output format
https://labelstud.io
Apache License 2.0
19.4k stars 2.41k forks source link

Cannot init a project with PostgreSQL #4620

Open b-niu opened 1 year ago

b-niu commented 1 year ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Run command as the document.
    label-studio start my_project --init -db postgresql
  2. See error

Environment (please complete the following information):

Screenshots

$ label-studio start my_project --init -db postgresql
=> Hostname correctly is set to: http://192.168.31.11:8080
=> Database and media directory: /home/user/.local/share/label-studio
=> Static URL is set to: /static/
=> Hostname correctly is set to: http://192.168.31.11:8080
=> Database and media directory: /home/user/.local/share/label-studio
=> Static URL is set to: /static/
[Tracing] Create new propagation context: {'trace_id': '29a11d3f7ffe464a8115200c70a09270', 'span_id': '82123a390da160cf', 'parent_span_id': None, 'dynamic_sampling_context': None}
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /pypi/label-studio/json HTTP/1.1" 200 57379
Can't read version file: ls-version_.py. Fall back to: version_.py
[2023-08-10 01:44:10,320] [root::_read_py::61] [WARNING] Can't read version file: ls-version_.py. Fall back to: version_.py
[2023-08-10 01:44:10,549] [root::_read_py::61] [WARNING] Can't read version file: ls-version_.py. Fall back to: version_.py
Traceback (most recent call last):
  File "/home/user/anaconda3/envs/labelstudio/bin/label-studio", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/anaconda3/envs/labelstudio/lib/python3.11/site-packages/label_studio/server.py", line 343, in main
    _init(input_args, config)
  File "/home/user/anaconda3/envs/labelstudio/lib/python3.11/site-packages/label_studio/server.py", line 188, in _init
    user = _create_user(input_args, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/anaconda3/envs/labelstudio/lib/python3.11/site-packages/label_studio/server.py", line 148, in _create_user
    if input_args.quiet_mode:
       ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'quiet_mode'
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-C to quit
ClaytonSmith commented 1 year ago

oh hey, I just hit this.

After digging it looks like if you provide a default username and pass you avoid the line that's throwing https://github.com/HumanSignal/label-studio/blob/develop/label_studio/server.py#L139 https://github.com/HumanSignal/label-studio/blob/develop/label_studio/server.py#L156

b-niu commented 1 year ago

Thank you @ClaytonSmith , I will try it.

brzyangg commented 1 year ago

I have same problem. I set username is default but problem still exist.

yanwenjie1 commented 11 months ago

Thank you @ClaytonSmith ,I succeeded.

jaimeromoreno commented 5 months ago

Hi! My problem is that Azure doesn't allow to set an Environment Key called USERNAME due to it is a reserved key. Do you know any other way to skip the quiet_mode error?

LorisET commented 2 months ago

@jaimeromoreno try to use LABEL_STUDIO_USERNAME, should it works

paululvinius commented 2 months ago

Hi! My problem is that Azure doesn't allow to set an Environment Key called USERNAME due to it is a reserved key. Do you know any other way to skip the quiet_mode error?

Found a workaround by instead providing the username and password in the startup command: label-studio start --init -db postgresql --username defaultuser --password badpassword