label-studio: AttributeError when trying to run label-studio after installing it via pip
Describe the bug
Installed Label Studio via pip, as described on main page. However, when I try to run it a Python exception is being thrown:
Traceback (most recent call last):
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,Starting new HTTPS connection (1): o227124.ingest.sentry.io:443
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\some.user\Miniconda3\envs\label-studio\Scripts\label-studio.exe\__main__.py", line 7, in <module>
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\label_studio\server.py", line 282, in main
_setup_env()
File "C:\Users\some_user\Miniconda3\envs\label-studio\lib\site-packages\label_studio\server.py", line 40, in _setup_env
application = get_wsgi_application()
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\django\core\wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\django\__init__.py", line 19, in setup
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\django\conf\__init__.py", line 82, in __getattr__
self._setup(name)
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\django\conf\__init__.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\django\conf\__init__.py", line 170, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Users\some.user\Miniconda3\envs\label-studio\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\some.user\Miniconda3\envs\label-studio\lib\site-packages\label_studio\core\settings\label_studio.py", line 46, in <module>
from label_studio.core.utils.common import collect_versions
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\label_studio\core\utils\common.py", line 36, in <module>
from drf_yasg.inspectors import CoreAPICompatInspector, NotHandled
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\drf_yasg\inspectors\__init__.py", line 5, in <module>
from .field import (
File "C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\drf_yasg\inspectors\field.py", line 406, in <module>
(serializers.NullBooleanField, (openapi.TYPE_BOOLEAN, None)),
AttributeError: module 'rest_framework.serializers' has no attribute 'NullBooleanField'. Did you mean: 'BooleanField'?
Tried installing in two separate environments, using python’s default venv and using conda, both times same error occured.
To Reproduce:
- run
pip install label-studio - run
label-studio
Environment (please complete the following information):
- OS: Microsoft Windows 10
- Label Studio Version: latest version from PyPi
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (7 by maintainers)
I had the same problem with djangorestframework v. 3.14.0
pip install djangorestframework=3.13.1made the problem go away; label-studio seems to work as intended.See also: https://stackoverflow.com/questions/73823743/attributeerror-module-rest-framework-serializers-has-no-attribute-nullboolea?noredirect=1&lq=1
It seems that drf_yasg package caused the error (reported here).
To temporarily fix the issue, …
C:\Users\some.user\Miniconda3\envs\label-studio\lib\site-packages\drf_yasg..\inspectors\field.pyfile and replace all ‘NullBooleanField’ to ‘BooleanField’.label-studio.This is only the workaround if you have urgent work to do. Use with care.
The problem is here:
Current platform is win32, apply sqlite fix Can’t load sqlite3.dll from current directory
You can download sqlite manually and place it in the directory where you run LS. Or you can use Anaconda Python, it has the correct SQLite lib inside.
x32 - https://www.sqlite.org/2022/sqlite-dll-win32-x86-3400000.zip x64 - https://www.sqlite.org/2022/sqlite-dll-win64-x64-3400000.zip
please do we need to install SQLite database before installing label studio ?
@vvaradarajan Could you try this:
Will it help?
HI guys
pip install -U label-studiodoes not improve anything. As a good practice, to mark the problem as solved, it is not enough to fix the problem in the source code, You have to release the version with fixes.