Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'rest_framework_simplejwt' #7072

Open
YiXi37 opened this issue Feb 13, 2025 · 1 comment
Open

ModuleNotFoundError: No module named 'rest_framework_simplejwt' #7072

YiXi37 opened this issue Feb 13, 2025 · 1 comment

Comments

@YiXi37
Copy link

YiXi37 commented Feb 13, 2025

When I was trying to run the label-studio
Execute command: python3 manage. py runserver
report errors
=> Database and media directory: /home/dapp/.local/share/label-studio
=> Static URL is set to: /static/
Read environment variables from: /home/dapp/.local/share/label-studio/.env
get 'SECRET_KEY' casted as '<class 'str'>' with default ''
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /pypi/label-studio/json HTTP/1.1" 200 33651
=> Database and media directory: /home/dapp/.local/share/label-studio
=> Static URL is set to: /static/
Read environment variables from: /home/dapp/.local/share/label-studio/.env
get 'SECRET_KEY' casted as '<class 'str'>' with default ''
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /pypi/label-studio/json HTTP/1.1" 200 33651
[2025-02-13 08:46:38,106] [django.utils.autoreload::run_with_reloader::668] [INFO] Watching for file changes with StatReloader
[2025-02-13 08:46:38,106] [django.utils.autoreload::run_with_reloader::668] [INFO] Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/python3.9/lib/python3.9/threading.py", line 980, in _bootstrap_inner
self.run()
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/sentry_sdk/integrations/threading.py", line 101, in run
return _run_old_run_func()
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/sentry_sdk/integrations/threading.py", line 96, in _run_old_run_func
reraise(*_capture_exception())
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/sentry_sdk/utils.py", line 1718, in reraise
raise value
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/sentry_sdk/integrations/threading.py", line 94, in _run_old_run_func
return old_run_func(self, *a, **kw)
File "/usr/local/python3.9/lib/python3.9/threading.py", line 917, in run
self._target(*self._args, **self._kwargs)
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/core/management/init.py", line 394, in execute
autoreload.check_errors(django.setup)()
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/app/virtual_python_env/code-label-studio/lib/python3.9/site-packages/django/apps/config.py", line 193, in create
import_module(entry)
File "/usr/local/python3.9/lib/python3.9/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 972, in _find_and_load_unlocked
File "", line 228, in _call_with_frames_removed
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'rest_framework_simplejwt'

I installed ‘rest_framework_simplejwt’, but it still reports the same error

@heidi-humansignal
Copy link
Collaborator

Hello,

Thank you for contacting Label Studio,

Could you please double check if you have installed the package in the same Python environment you’re using to run Label Studio. For example, verify its installation by running:

pip freeze | grep djangorestframework-simplejwt
  1. If it’s not present (or to be sure), uninstall any conflicting packages and install it explicitly:

    pip uninstall rest_framework_simplejwt djangorestframework-simplejwtpip install djangorestframework-simplejwt

  2. Ensure that you’re activating the correct virtual environment (if you’re using one) before running:

    python3 manage.py runserver

Sometimes issues like this can also arise if there are multiple Python installations and the package got installed in a different one. Double-check your environment and your PYTHONPATH to be sure.

Could you please confirm that the package is installed in your environment (you should see an entry like “djangorestframework‐simplejwt==[version]” in your pip list) and that you’re using the intended interpreter?

Let me know if this helps or if you need further assistance.

Comment by Oussama Assili
Workflow Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants