AttributeError: module 'django.db.models' has no attribute 'SubfieldBase'

I'm trying to run application originally created using python 3.6 and django 1.11 with python 3.7 and django 2.2.

I'm now getting problems when starting django server:

python manage.py runserver

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/opt/python/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/opt/python/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
    raise _exception[0](_exception[1]).with_traceback(_exception[2])
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn(*args, **kwargs)
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/tandt/models.py", line 20, in <module>
    from select_multiple_field.models import SelectMultipleField
  File "/srv/work/miettinj/tandt_putki/python/django/tandt/python-3.7-django-*/lib/python3.7/site-packages/select_multiple_field/models.py", line 20, in <module>
    class SelectMultipleField(six.with_metaclass(models.SubfieldBase,
AttributeError: module 'django.db.models' has no attribute 'SubfieldBase'

my virtualenv:

(python-3.7-django-*) miettinj@ramen:~/tandt_putki/python/django/tandt> pip freeze
adal==1.2.7
aniso8601==7.0.0
anyascii==0.3.1
asgiref==3.6.0
azure-core==1.26.2
backports.zoneinfo==0.2.1
bcrypt==4.0.1
beautifulsoup4==4.11.1
bleach==6.0.0
certifi==2022.12.7
cffi==1.15.1
chardet==5.1.0
charset-normalizer==3.0.1
cryptography==39.0.0
Django==2.2
django-auth-ldap==4.1.0
django-ckeditor==6.3.2
django-contrib-comments==2.2.0
django-cors-headers==3.11.0
django-debug-toolbar==3.2.4
django-filter==21.1
django-jinja==2.10.2
django-js-asset==2.0.0
django-modelcluster==6.0
django-multiselectfield==0.1.12
django-select-multiple-field==0.4.2
django-storages==1.12.3
django-taggit==2.1.0
django-tinymce==3.5.0
django-treebeard==4.5.1
django-utils-six==2.0
djangorestframework==3.13.1
draftjs-exporter==5.0.0
enum34==1.1.10
et-xmlfile==1.1.0
filebrowser-safe==1.1.1
future==0.18.3
futures==3.0.5
graphene==2.1.8
graphene-django==2.0.0
graphql-core==2.3.2
graphql-relay==2.0.1
grappelli-safe==1.1.1
highlightext==0.3.3
html5lib==1.1
httplib2==0.21.0
idna==3.4
ipaddress==1.0.23
iso8601==1.1.0
isodate==0.6.1
Jinja2==3.1.2
l18n==2021.3
libvoikko==4.1.1.8
lxml==4.9.2
MarkupSafe==2.1.2
Mezzanine==6.0.0
msrest==0.7.1
msrestazure==0.6.4
oauthlib==3.2.2
object-listing==0.2.2
openpyxl==3.0.10
packaging==23.0
paramiko==3.0.0
Pillow==9.4.0
promise==2.3
psycopg2==2.9.5
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.21
PyJWT==2.6.0
PyNaCl==1.5.0
pyparsing==3.0.9
pysolr==3.9.0
python-dateutil==2.8.2
python-json-logger==2.0.4
python-ldap==3.4.3
pytz==2022.7.1
pytz-deprecation-shim==0.1.0.post0
requests==2.28.2
requests-oauthlib==1.3.1
Rx==1.6.3
singledispatch==4.0.0
six==1.16.0
soupsieve==2.3.2.post1
sqlparse==0.4.3
statfi==0.6
statfi-paginator==0.4
statfi-search==1.14
statfi.django.ad==0.12
statfi.django.base==0.6.1
statfi.logging==0.2.1
tablib==3.3.0
telepath==0.3
text-unidecode==1.3
tinycss2==1.1.1
typing_extensions==4.4.0
tzdata==2022.7
tzlocal==4.2
urllib3==1.26.14
voikko==0.5
webencodings==0.5.1
whitenoise==6.3.0
Willow==1.4.1
xlrd==2.0.1
XlsxWriter==3.0.7
xlwt==1.3.0

I guess I should change the following in my models.py

from select_multiple_field.models import SelectMultipleField

or change something in my virtual env, jos don't discover what

Back to Top