Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django: ImportError: No module named social.apps.django_app

I had an application that I created in Windows 7, and it worked perfectly. A few days back, I migrated to Ubuntu and copied the project file in Ubuntu. Now, when I try running the project using python manage.py runserver, I get the following error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 112, in create
    mod = import_module(mod_path)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named social.apps.django_app

What seems to be wrong here? I'm new to Ubuntu, so any help would be appreciated. I have the same version of Python and Django installed in Ubuntu that I had in Windows as well.

like image 729
Manas Chaturvedi Avatar asked Jul 28 '15 14:07

Manas Chaturvedi


3 Answers

It looks like you need to install a module on your ubuntu machine that already exists on your windows 7 environment. If you have pip installed, try this on Windows & Ubuntu, and look for missing packages

pip freeze

You will see something on your windows environment that is missing on Ubuntu, like python-social-auth -- your fix will be do something like on Ubuntu:

pip install python-social-auth

or

sudo pip install python-social-auth
like image 137
Mark Chackerian Avatar answered Nov 02 '22 07:11

Mark Chackerian


Do you use virtual environment for your project? if so, be sure that you have activated it before installing your project dependencies, use pip freeze inside your virtual env. to see the installed packages, if you do not use it, simple pip install python-social-auth should normaly resolve your problem.

For me, I can see the following list of installed packages inside my virtual environment (using Ubuntu 14.04 and Python 2.7.6):

(venv)root@ubuntu:/home/ubuntu/test-auth# pip install python-social-auth
(venv)root@ubuntu:/home/ubuntu/test-auth# pip freeze
PyJWT==1.4.0
argparse==1.2.1
oauthlib==1.0.1
python-openid==2.2.5
python-social-auth==0.2.12
requests==2.7.0
requests-oauthlib==0.5.0
six==1.9.0
wsgiref==0.1.2
like image 21
ettanany Avatar answered Nov 02 '22 09:11

ettanany


social-auth-app-django is the one that should be used since they reorganized the code base.

like image 2
Pierre de LESPINAY Avatar answered Nov 02 '22 07:11

Pierre de LESPINAY