I am a total novice with both PostGIS and Python - I am just trying to get this game running. I have followed the instructions here and here and am now at a dead end. I have pgAdmin 4 downloaded and running with PostGRESQL10 and the PostGIS extensions. However, when I try to set up the database with Python in Command Prompt (file location>python tools\set_up_db.py), I receive the following message:

Connecting to database
        ->host='localhost' port='5432' dbname='sessions' user='postgres' password='xxxxx'
CREATE TABLE IF NOT EXISTS dggrid (id BIGSERIAL PRIMARY KEY, gid bigint UNIQUE, geo geometry, center geometry, population int, employment int);
Traceback (most recent call last):
  File "tools\set_up_db.py", line 22, in <module>
psycopg2.ProgrammingError: type "geometry" does not exist
LINE 1: ...(id BIGSERIAL PRIMARY KEY, gid bigint UNIQUE, geo geometry, ...

Looking around, it seems like this may be an issue with my Schema. My default Schema is "public," and I've tried to change the database's search path to "public, postgis," which hasn't helped. No idea if I'm on the right track here at all. As far as I can tell, I've done everything else correctly in the instructions...

  • 3
    It's awful security practice to ever create tables as postgres. If you haven't created the PostGIS extension within the database (CREATE EXTENSION postgis), you need to do that first, as per the documentation.
    – Vince
    Oct 12, 2018 at 3:08
  • 1
    I use PGAdmin to create the database(s) I need, use the template_postgis as the template... but in recent versions this template isn't created by the install in preference of CREATE EXTENSION postgis as Vince said. If you have a PostGIS template database it makes it a lot easier to create a new spatial database in PGAdmin. enmodal doesn't sound much like a game, more like a simulator, though a sim can be a game if it entertains I guess. Oct 12, 2018 at 4:37
  • Also, make sure your script isn't explicitly setting the search path to exclude the schema that the geometry data type belongs to (usually, public). Oct 12, 2018 at 12:35
  • @JayCummins - thanks. Where do I go to look to see a specific schema is being excluded?
    – sfhkshcv
    Oct 13, 2018 at 16:36
  • What version of PostGIS? run: SELECT PostGIS_full_version(); Apr 17, 2019 at 15:25

1 Answer 1


PostGIS extension has not been created. In order to install it you must follow these steps and then run your db create.

1.open pgAdmin 2.select (click) your database 3.click "SQL" icon on the bar 4.copy CREATE EXTENSION postgis; and then run it.

  • Nope, PostGIS extension is there...
    – sfhkshcv
    Oct 13, 2018 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.