[Python-modules-team] Bug#896272: python3-django-netfields: netfields fails to import

Helmut Grohne helmut at subdivi.de
Fri Apr 20 21:01:23 BST 2018


Package: python3-django-netfields
Version: 0.8-1
Severity: serious
User: helmutg at debian.org
Usertags: python-import

After installing python3-django-netfields importing the module netfields
into a python interpreter fails with the following error:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/db/backends/postgresql/base.py", line 21, in <module>
    import psycopg2 as Database
ModuleNotFoundError: No module named 'psycopg2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/netfields/__init__.py", line 2, in <module>
    from netfields.fields import (InetAddressField, CidrAddressField,
  File "/usr/lib/python3/dist-packages/netfields/fields.py", line 3, in <module>
    from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
  File "/usr/lib/python3/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 1, in <module>
    from ..postgresql.base import *  # NOQA
  File "/usr/lib/python3/dist-packages/django/db/backends/postgresql/base.py", line 25, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'

The vast majority of import failures is attributed to missing dependencies.
Often times that manifests as an ImportError or ModuleNotFoundError.
Typically, dependencies should be inserted by dh-python via ${python:Depends}
or ${python3:Depends}. Thus a missing dependency can be caused by incomplete
install_requires in setup.py. Sometimes a missing dependency of a dependency
is the cause, in such cases this bug should be reassigned.

Helmut



More information about the Python-modules-team mailing list