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
17.38k stars 2.16k forks source link

Deploy offline #3969

Open turkeymz opened 1 year ago

turkeymz commented 1 year ago

Same as https://github.com/heartexlabs/label-studio/issues/3940#event-8919569453

The server can't deploy in offline env? Suggest using default values if unable to access the external network.

makseq commented 1 year ago

Please show full logs.

turkeymz commented 1 year ago

Please show full logs. Thanks for your reply. Here is the full logs


# label-studio -b --data-dir /home/jxbd/labelstudio/mydata -p 5008 --host 0.0.0.0 --password jxbd123  --username admin start

=> Database and media directory: /root/.local/share/label-studio => Static URL is set to: /static/ => Database and media directory: /root/.local/share/label-studio => Static URL is set to: /static/ Starting new HTTPS connection (1): pypi.org:443 Can't get latest version Traceback (most recent call last): File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn conn.connect() File "/root/.local/lib/python3.8/site-packages/urllib3/connection.py", line 414, in connect self.sock = ssl_wrapsocket( File "/root/.local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "/root/.local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/local/python3/lib/python3.8/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/local/python3/lib/python3.8/ssl.py", line 1040, in _create self.do_handshake() File "/usr/local/python3/lib/python3.8/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/python3/lib/python3.8/site-packages/requests/adapters.py", line 440, in send resp = conn.urlopen( File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 787, in urlopen retries = retries.increment( File "/root/.local/lib/python3.8/site-packages/urllib3/util/retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) File "/root/.local/lib/python3.8/site-packages/urllib3/packages/six.py", line 769, in reraise raise value.with_traceback(tb) File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "/root/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn conn.connect() File "/root/.local/lib/python3.8/site-packages/urllib3/connection.py", line 414, in connect self.sock = ssl_wrapsocket( File "/root/.local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "/root/.local/lib/python3.8/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/local/python3/lib/python3.8/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/local/python3/lib/python3.8/ssl.py", line 1040, in _create self.do_handshake() File "/usr/local/python3/lib/python3.8/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/python3/lib/python3.8/site-packages/label_studio/core/utils/common.py", line 339, in get_latest_version response = requests.get(pypi_url, timeout=10).text File "/usr/local/python3/lib/python3.8/site-packages/requests/api.py", line 75, in get return request('get', url, params=params, kwargs) File "/usr/local/python3/lib/python3.8/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/local/python3/lib/python3.8/site-packages/requests/sessions.py", line 529, in request resp = self.send(prep, send_kwargs) File "/usr/local/python3/lib/python3.8/site-packages/requests/sessions.py", line 645, in send r = adapter.send(request, kwargs) File "/usr/local/python3/lib/python3.8/site-packages/requests/adapters.py", line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) Traceback (most recent call last): File "/usr/local/python3/bin/label-studio", line 8, in sys.exit(main()) File "/usr/local/python3/lib/python3.8/site-packages/label_studio/server.py", line 296, in main _setup_env() File "/usr/local/python3/lib/python3.8/site-packages/label_studio/server.py", line 40, in _setup_env application = get_wsgi_application() File "/usr/local/python3/lib/python3.8/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application django.setup(set_prefix=False) File "/usr/local/python3/lib/python3.8/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/python3/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/usr/local/python3/lib/python3.8/site-packages/django/apps/config.py", line 301, in import_models self.models_module = import_module(models_module_name) File "/usr/local/python3/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/usr/local/python3/lib/python3.8/site-packages/django/contrib/auth/models.py", line 3, in from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "/usr/local/python3/lib/python3.8/site-packages/django/contrib/auth/base_user.py", line 48, in class AbstractBaseUser(models.Model): File "/usr/local/python3/lib/python3.8/site-packages/django/db/models/base.py", line 122, in new new_class.add_to_class('_meta', Options(meta, app_label)) File "/usr/local/python3/lib/python3.8/site-packages/django/db/models/base.py", line 326, in add_to_class value.contribute_to_class(cls, name) File "/usr/local/python3/lib/python3.8/site-packages/django/db/models/options.py", line 207, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) File "/usr/local/python3/lib/python3.8/site-packages/django/utils/connection.py", line 15, in getattr return getattr(self._connections[self._alias], item) File "/usr/local/python3/lib/python3.8/site-packages/django/utils/connection.py", line 62, in getitem conn = self.create_connection(alias) File "/usr/local/python3/lib/python3.8/site-packages/django/db/utils.py", line 204, in create_connection backend = load_backend(db['ENGINE']) File "/usr/local/python3/lib/python3.8/site-packages/django/db/utils.py", line 111, in load_backend return import_module('%s.base' % backend_name) File "/usr/local/python3/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/usr/local/python3/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 73, in check_sqlite_version() File "/usr/local/python3/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 68, in check_sqlite_version raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: SQLite 3.9.0 or later is required (found 3.7.17). Sentry is attempting to send 2 pending error messages Waiting up to 2 seconds Press Ctrl-C to quit

makseq commented 1 year ago

It seems LS works as expected, just ignore this error message.

turkeymz commented 1 year ago

It seems LS works as expected, just ignore this error message.

But LS can't ignore this error.When this error occurs, LS will automatically stop the thread. It seems that LS calling pypi.org is just getting the version. Is there any way to make LS stop calling pypi.org and deploy offline?

farioas commented 1 year ago

If you set env variable LABEL_STUDIO_LATEST_VERSION_CHECK=False this check will be skipped

turkeymz commented 1 year ago

Sorry, I was wrong, seems it can be deployed offline

Adamits commented 3 weeks ago

If you set env variable LABEL_STUDIO_LATEST_VERSION_CHECK=False this check will be skipped

This does not seem to do anything.

While I can deploy label-studio offline, it is incredibly slow because so many operations result in this check, which tries to connect to a url until it fails a few times. Is this deprecated? Is there a different way to turn this behavior off?

farioas commented 2 weeks ago

The code related to version check is here: https://github.com/HumanSignal/label-studio/blob/develop/label_studio/core/utils/common.py#L394

If LABEL_STUDIO_LATEST_VERSION_CHECK set to False it will exit the function.

wfoglema commented 1 week ago

It's also not working for me.

I did some digging and I found the variable LABEL_STUDIO_LATEST_VERSION_CHECK in the base settings file (https://github.com/HumanSignal/label-studio/blob/develop/label_studio/core/settings/base.py#L523) but it looks like it's hard coded to always be True.

farioas commented 1 week ago

/jira create

Workflow run Jira issue TRIAG-632 is created