from django.utils.importlib import import_module ImportError: No module named importlib

I am new to Django. I got a Django rest project. When i run it, an error shows as

from django.utils.importlib import import_module
ImportError: No module named importlib

I tried installing importlib with the command

pip install importlib

Then it shows

Requirement already satisfied: importlib in ./lib/python2.7/site-packages/gcm/utils.py"

So how coild i install importlib package?

Solution #1:

You don’t. importlib is part of python since v2.7. The project you want to run seems to be an old project that still uses the compatibility module provided by old Django versions for when it supported python 2.6. It’s been obsolete since Django 1.7. That means it’s twofold outdated.

Replace all occurences of django.utils.importlib with importlib.
But the project being clearly outdated, you will probably run into many other issues.

Respondent: Hari Krishnan

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.