title: how to fix this error: No module named 'allauth'?
body: <p>I want to use allauth in django API but when I installed it I got some errors I fixed it by django.setup() and after that, I get the error which tells me that I have to set DJANGO_SETTINGS_MODULE now I did that in manage.py:</p>
  <pre><code>#!/usr/bin/env python
  &quot;&quot;&quot;Django's command-line utility for administrative tasks.&quot;&quot;&quot;
  import os
  import sys
  import django
  
  
  def main():
      os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings')
      try:
          from django.core.management import execute_from_command_line
      except ImportError as exc:
          raise ImportError(
              &quot;Couldn't import Django. Are you sure it's installed and &quot;
              &quot;available on your PYTHONPATH environment variable? Did you &quot;
              &quot;forget to activate a virtual environment?&quot;
          ) from exc
      execute_from_command_line(sys.argv)
  
  
  if __name__ == '__main__':
      os.environ['DJANGO_SETTINGS_MODULE'] = 'website.settings'
      django.setup()
      main()
  </code></pre>
  <p>but I get this Traceback:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;manage.py&quot;, line 23, in &lt;module&gt;
      django.setup()
    File &quot;/home/abdelhamedabdin/.local/lib/python3.8/site-packages/django/__init__.py&quot;, line 24, in setup
      apps.populate(settings.INSTALLED_APPS)
    File &quot;/home/abdelhamedabdin/.local/lib/python3.8/site-packages/django/apps/registry.py&quot;, line 91, in populate
      app_config = AppConfig.create(entry)
    File &quot;/home/abdelhamedabdin/.local/lib/python3.8/site-packages/django/apps/config.py&quot;, line 90, in create
      module = import_module(entry)
    File &quot;/usr/lib/python3.8/importlib/__init__.py&quot;, line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1014, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 991, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 973, in _find_and_load_unlocked
  ModuleNotFoundError: No module named 'allauth'
  </code></pre>
  <p>please can anyone tells me how can I fix that exception error? I did many searches but I get no help and I asked here but also I got no help so, please if anyone can help me!</p>
  <p><strong>Additional information:</strong><br>
  that is what I did in settings.py after I installed allauth by pip3</p>
  <pre><code>INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.sites',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'allauth',
      'allauth.account',
      'allauth.socialaccount',
      'allauth.account.auth_backends.AuthenticationBackend',
      'index.apps.IndexConfig',
      'account.apps.AccountConfig',
      'community.apps.CommunityConfig',
  ]
  
  AUTHENTICATION_BACKENDS = (
      &quot;django.contrib.auth.backends.ModelBackend&quot;,
      &quot;allauth.account.auth_backends.AuthenticationBackend&quot;,
  )
  
  SITE_ID = 1
  </code></pre>
  <p>and in urls.py</p>
  <pre><code>path('accounts/', include('allauth.urls')),
  </code></pre>
  <p><strong>Edit post:</strong></p>
  <p>by using virtualenv that Trace has raised:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;manage.py&quot;, line 23, in &lt;module&gt;
      django.setup()
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/__init__.py&quot;, line 24, in setup
      apps.populate(settings.INSTALLED_APPS)
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/registry.py&quot;, line 91, in populate
      app_config = AppConfig.create(entry)
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/config.py&quot;, line 90, in create
      module = import_module(entry)
    File &quot;/usr/lib/python3.8/importlib/__init__.py&quot;, line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1014, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 991, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 961, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1014, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 991, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 975, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 671, in _load_unlocked
    File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 783, in exec_module
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/allauth/account/auth_backends.py&quot;, line 3, in &lt;module&gt;
      from django.contrib.auth.backends import ModelBackend
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/contrib/auth/backends.py&quot;, line 5, in &lt;module&gt;
      from django.contrib.auth.models import Permission
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/contrib/auth/models.py&quot;, line 2, in &lt;module&gt;
      from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/contrib/auth/base_user.py&quot;, line 47, in &lt;module&gt;
      class AbstractBaseUser(models.Model):
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/db/models/base.py&quot;, line 107, in __new__
      app_config = apps.get_containing_app_config(module)
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/registry.py&quot;, line 252, in get_containing_app_config
      self.check_apps_ready()
    File &quot;/media/abdelhamedabdin/BE4C6BE74C6B98C3/Cources/Django/all git/ripo/website/venv/lib/python3.8/site-packages/django/apps/registry.py&quot;, line 135, in check_apps_ready
      raise AppRegistryNotReady(&quot;Apps aren't loaded yet.&quot;)
  </code></pre>