django-geojson icon indicating copy to clipboard operation
django-geojson copied to clipboard

UWSGI crashes after installing django-geojson

Open thomas-maschler opened this issue 6 years ago • 2 comments

Hi, i try to use django-geojson for one of my project with Using django 2.1.4 and Python 3.7. After installing the module, my UWSGI crashes.

I get the following traceback

*** Operational MODE: single process ***
mounting kobo_project.wsgi:application on /surveys
Traceback (most recent call last):
  File "./kobo_project/wsgi.py", line 20, in <module>
    application = get_wsgi_application()
  File "/usr/local/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/usr/local/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py", line 120, in populate
    app_config.ready()
  File "/usr/local/lib/python3.7/site-packages/django/contrib/admin/apps.py", line 24, in ready
    self.module.autodiscover()
  File "/usr/local/lib/python3.7/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/usr/local/lib/python3.7/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.7/site-packages/leaflet/admin.py", line 8, in <module>
    from djgeojson.fields import GeoJSONField
  File "/usr/local/lib/python3.7/site-packages/djgeojson/__init__.py", line 2, in <module>
    from pkg_resources import DistributionNotFound
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3126, in <module>
    @_call_aside
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3110, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3139, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 572, in _build_master
    ws = cls()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 565, in __init__
    self.add_entry(entry)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 619, in add_entry
    self.entry_keys.setdefault(entry, [])
TypeError: unhashable type: 'list'
unable to load app 0 (mountpoint='/surveys') (callable not found or import error)

Deinstalling django-geojson solves the issue. Do you have a hint how I can make use of your module?

thomas-maschler avatar Dec 13 '18 17:12 thomas-maschler

I have the same issue with Django 2.2.5 and Python 3.7.

Traceback (most recent call last): File "manage.py", line 21, in execute_from_command_line(sys.argv) File "/usr/local/paleocore/venv/lib/python3.7/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/paleocore/venv/lib/python3.7/site-packages/django/core/management/init.py", line 357, in execute django.setup() File "/usr/local/paleocore/venv/lib/python3.7/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/paleocore/venv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/usr/local/paleocore/venv/lib/python3.7/site-packages/django/apps/config.py", line 90, in create module = import_module(entry) File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/usr/local/paleocore/venv/lib/python3.7/site-packages/djgeojson/init.py", line 2, in from pkg_resources import DistributionNotFound File "/usr/local/paleocore/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3258, in @_call_aside File "/usr/local/paleocore/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3242, in _call_aside f(*args, **kwargs) File "/usr/local/paleocore/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 3271, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/local/paleocore/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 575, in _build_master ws = cls() File "/usr/local/paleocore/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 568, in init self.add_entry(entry) File "/usr/local/paleocore/venv/lib/python3.7/site-packages/pkg_resources/init.py", line 622, in add_entry self.entry_keys.setdefault(entry, []) TypeError: unhashable type: 'Path'

dennereed avatar Apr 17 '20 05:04 dennereed

The issue seems to be related to setuptools pkg_resources trying to import DistributionNotFound. Editing the init.py file for the package to remove the distro information and manually set the version resolves the issue. This may be an issue with setuptools configuration when running in virtual environments.

dennereed avatar Apr 17 '20 05:04 dennereed