How to debug ImportEror "No Module named ..."
Question: I am using Django Rest Framework. When I try to go to the swagger docs page, I
am getting ImportError: No module named drf_compound_fields

    
    
    from  serializers.py where I try to import the following
    
    from drf_compound_fields.fields import ListField
    

I have drf-compound-field 0.2.2 in my virtualenv and I ran pip list command to
make sure that it is installed.

Here is what I get from manage.py shell

    
    
     Python 2.7.6 (default, Mar 22 2014, 22:59:56)   
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    (InteractiveConsole)
    >>> 
    >>> 
    >>> 
    >>> 
    >>> from drf_compound_fields.fields import ListField
    Traceback (most recent call last):
    File "<console>", line 1, in <module>
    ImportError: No module named drf_compound_fields.fields
    >>> 
    

Thanks for your help!!


Answer: drf-compound-fields was installed under the same virtualenv where the django
server was being run from. Apparently it needs to be installed at the system
level and not necessarily at the virtualenv level. Following steps worked for
me: 1) Get out of virtualenv. 2) pip install def-compound-fields 3) get in
virtualenv and start django process

