'ImportError: No module named allauth. Django

in a project with django, when I do "python manage.py runserver" I get this error traceback :

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
    autoreload.raise_last_exception()
  File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 250, in raise_last_exception
    six.reraise(*_exception)
  File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "C:\Python27\lib\site-packages\django\__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Python27\lib\site-packages\django\apps\registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "C:\Python27\lib\site-packages\django\apps\config.py", line 94, in create
    module = import_module(entry)
  File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named allauth

I installed allauth using pip3 install allauth. And this is my INSTALLED_APPS :

INSTALLED_APPS = [
    'music.apps.MusicConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.facebook',
]


Solution 1:[1]

Please make sure you have activated the virtualenv in which you have installed allauth

Solution 2:[2]

You have to install django-allauth package. In other words, please run following command.

  • in case of using pip
$ pip install django-allauth
  • in case of using pipenv
$ pipenv install django-allauth

Solution 3:[3]

Are you using the exact same python interpreter to run your Django project that the one you are using to install packages to with pip?

I would recommend using virtualenvto install packages to it, and then using it in your Django project.

One thing that might be happening is that you have multiple interpreters installed on your machine. I.E. Python 2, and Python 3. In that case, do make sure you are pip installing to the same interpreter you are using to run your Django project.

I.E.:

$ pip install allauth

What happens if you do:

$ python
> import allauth

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Atley Varghese
Solution 2 Venus713
Solution 3