Repository: doccano/doccano

Issue:
ModuleNotFoundError: No module named 'dj_rest_auth'
<!-- Before submitting an issue, make sure to check the docs and closed issues and FAQ to see if any of the solutions work for you. https://github.com/doccano/doccano/wiki/Frequently-Asked-Questions -->

I was using `pip install` to install doccano, which is due to my lack of knowledge about docker. And I run into the following problem:  
(To sum up, module `dj_rest_auth` was not found when setting up database and createing admin user.)

```bash
(pytorch) D:\pythonwork\NLP\grad>doccano 
Setup Database. 
Traceback (most recent call last): 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\app\manage.py", line 15, in <module> 
    execute_from_command_line(sys.argv) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line 
    utility.execute() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 377, in execute 
    django.setup() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\__init__.py", line 24, in setup 
    apps.populate(settings.INSTALLED_APPS) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\registry.py", line 91, in populate 
    app_config = AppConfig.create(entry) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\config.py", line 90, in create 
    module = import_module(entry) 
  File "d:\anaconda3\envs\pytorch\lib\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 965, in _find_and_load_unlocked 
ModuleNotFoundError: No module named 'dj_rest_auth' 
Traceback (most recent call last): 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\app\manage.py", line 15, in <module> 
    execute_from_command_line(sys.argv) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line 
    utility.execute() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 377, in execute 
    django.setup() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\__init__.py", line 24, in setup 
    apps.populate(settings.INSTALLED_APPS) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\registry.py", line 91, in populate 
    app_config = AppConfig.create(entry) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\config.py", line 90, in create 
    module = import_module(entry) 
  File "d:\anaconda3\envs\pytorch\lib\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 965, in _find_and_load_unlocked 
ModuleNotFoundError: No module named 'dj_rest_auth' 
Traceback (most recent call last): 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\app\manage.py", line 15, in <module> 
    execute_from_command_line(sys.argv) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line 
    utility.execute() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 377, in execute 
    django.setup() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\__init__.py", line 24, in setup 
    apps.populate(settings.INSTALLED_APPS) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\registry.py", line 91, in populate 
    app_config = AppConfig.create(entry) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\config.py", line 90, in create 
    module = import_module(entry) 
  File "d:\anaconda3\envs\pytorch\lib\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 965, in _find_and_load_unlocked 
ModuleNotFoundError: No module named 'dj_rest_auth' 
Create admin user. 
Traceback (most recent call last): 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\app\manage.py", line 15, in <module> 
    execute_from_command_line(sys.argv) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line 
    utility.execute() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 377, in execute 
    django.setup() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\__init__.py", line 24, in setup 
    apps.populate(settings.INSTALLED_APPS) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\registry.py", line 91, in populate 
    app_config = AppConfig.create(entry) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\config.py", line 90, in create 
    module = import_module(entry) 
  File "d:\anaconda3\envs\pytorch\lib\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 965, in _find_and_load_unlocked 
ModuleNotFoundError: No module named 'dj_rest_auth' 
Starting server with port 8000. 
Exception in thread django-main-thread: 
Traceback (most recent call last): 
  File "d:\anaconda3\envs\pytorch\lib\threading.py", line 926, in _bootstrap_inner 
    self.run() 
  File "d:\anaconda3\envs\pytorch\lib\threading.py", line 870, in run 
    self._target(*self._args, **self._kwargs) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper 
    fn(*args, **kwargs) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\commands\runserver.py", line 110, in inner_run 
    autoreload.raise_last_exception() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 76, in raise_last_exception 
    raise _exception[1] 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 357, in execute 
    autoreload.check_errors(django.setup)() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper 
    fn(*args, **kwargs) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\__init__.py", line 24, in setup 
    apps.populate(settings.INSTALLED_APPS) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\registry.py", line 91, in populate 
    app_config = AppConfig.create(entry) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\apps\config.py", line 90, in create 
    module = import_module(entry) 
  File "d:\anaconda3\envs\pytorch\lib\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 965, in _find_and_load_unlocked 
ModuleNotFoundError: No module named 'dj_rest_auth' 
 
Traceback (most recent call last): 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\app\manage.py", line 15, in <module> 
    execute_from_command_line(sys.argv) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line 
    utility.execute() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\__init__.py", line 395, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv 
    self.execute(*args, **cmd_options) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\commands\runserver.py", line 61, in execute 
    super().execute(*args, **options) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\base.py", line 371, in execute 
    output = self.handle(*args, **options) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\commands\runserver.py", line 96, in handle 
    self.run(**options) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\core\management\commands\runserver.py", line 103, in run 
    autoreload.run_with_reloader(self.inner_run, **options) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 618, in run_with_reloader 
    start_django(reloader, main_func, *args, **kwargs) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 603, in start_django 
    reloader.run(django_main_thread) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 318, in run 
    self.run_loop() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 324, in run_loop 
    next(ticker) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 364, in tick 
    for filepath, mtime in self.snapshot_files(): 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 380, in snapshot_files 
    for file in self.watched_files(): 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 278, in watched_files 
    yield from iter_all_python_module_files() 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 105, in iter_all_python_module_files 
    return iter_modules_and_files(modules, frozenset(_error_files)) 
  File "d:\anaconda3\envs\pytorch\lib\site-packages\django\utils\autoreload.py", line 141, in iter_modules_and_files 
    resolved_path = path.resolve(strict=True).absolute() 
  File "d:\anaconda3\envs\pytorch\lib\pathlib.py", line 1166, in resolve 
    s = self._flavour.resolve(self, strict=strict) 
  File "d:\anaconda3\envs\pytorch\lib\pathlib.py", line 200, in resolve 
    return self._ext_to_normal(_getfinalpathname(s)) 
OSError: [WinError 123] 文件名、目录名或卷标语法不正确。: '<frozen importlib._bootstrap>'
```
It seemed to be something wrong with `File <frozen importlib._bootstrap>`, but I cannot find the position of it. 

Your Environment
---------
<!-- Include details of your environment.-->
*   Operating System: Windows
*   Python Version Used: 3.7.10
*   When you install doccano: 2021.03.30
*   How did you install doccano (Heroku button etc): pip install



Discussion:
Oops, I forgot to add it to the dependency.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -35,7 +35,8 @@
     'seqeval>=1.2.2',
     'social-auth-app-django>=4.0.0',
     'whitenoise>=5.2.0',
-    'auto-labeling-pipeline>=0.1.12'
+    'auto-labeling-pipeline>=0.1.12',
+    'dj-rest-auth>=2.1.4'
 ]
 
 setup(


Test patch: