aequilibrae 1.5.1 goes AWOL during zone creation

21 views
Skip to first unread message

Tim Klein

unread,
Jan 10, 2026, 6:48:32 AM (9 days ago) Jan 10
to AequilibraE
Dear All,

i upgraded from 0.9.5 to 1.5.1 with Python 3.12.10 on Windows 11 and am using a script (that used to work fine) to create zones and zone centroids in a given project database. 
In the script, i begin by deleting existing matrices, zones and zone connectors; add zone attributes and then enter the zone data from a pandas dataframe:

i = 0
for idx, record in df.iterrows():
            new_zone = zones.new(i)
            z_geom = load_wkt(record['geometry'])
            new_zone.geometry = z_geom
            z_centroid = load_wkt(record['centroid'])
            new_zone.add_centroid(z_centroid)
            new_zone.save()
            i += 1

What happens is, that the python console (IDLE) just restarts after entering 493 zones. 
No error messages. 

The database table contains the records with the given zone ids, but nothing else (geometry column says "BLOB" in DB Browser). The log goes like this:

2026-01-10 12:42:01,727;INFO ; Zone with id 0 was created
2026-01-10 12:42:01,727;INFO ; Zone with id 0 was created
2026-01-10 12:42:02,082;INFO ; Zone with id 1 was created
2026-01-10 12:42:02,082;INFO ; Zone with id 1 was created
2026-01-10 12:42:02,140;WARNING ; Centroid already exists. Failed to create it
2026-01-10 12:42:02,140;WARNING ; Centroid already exists. Failed to create it
2026-01-10 12:42:02,299;INFO ; Zone with id 2 was created
2026-01-10 12:42:02,299;INFO ; Zone with id 2 was created
2026-01-10 12:42:02,351;WARNING ; Centroid already exists. Failed to create it
2026-01-10 12:42:02,351;WARNING ; Centroid already exists. Failed to create it
...
2026-01-10 12:43:45,758;INFO ; Zone with id 492 was created
2026-01-10 12:43:45,758;INFO ; Zone with id 492 was created
2026-01-10 12:43:45,808;WARNING ; Centroid already exists. Failed to create it
2026-01-10 12:43:45,808;WARNING ; Centroid already exists. Failed to create it
2026-01-10 12:43:45,948;INFO ; Zone with id 493 was created
2026-01-10 12:43:45,948;INFO ; Zone with id 493 was created
2026-01-10 12:43:45,998;WARNING ; Centroid already exists. Failed to create it
2026-01-10 12:43:45,998;WARNING ; Centroid already exists. Failed to create it

Any ideas? I' am out of my wits here. Thanks in advance!

Tim

Jamie Cook

unread,
Jan 12, 2026, 6:24:46 PM (7 days ago) Jan 12
to Tim Klein, AequilibraE
Hey Tim, 

That seems strange indeed. Could I ask you to provide a few more details so we can hopefully get to the bottom of this?

1. Is the script you are running small enough to share?
2. Same question about your model?
3. Can you clarify how you are running your script? You mention IDLE which I don't have familiarity with, can you maybe try running your script directly from the command line (python my_script.py) ? Can you add some logging to see if there is a particular line of the script that is causing the crash?
4. In SQLite, BLOB is a "Binary Large OBject" and is the standard way in which spatialite stores geometry data in the database - so that doesn't seem to be a problem per se, can that database and the zone boundaries be opened in QGIS?
5. The only thing I see in the logs (apart from the fact that each message seems to be duplicated) is the warning about the centroid already existing. Again I'm not sure this is a problem, aequilibrae has triggers which can automate things (like updating a link if it's A node moves for example) - I'm not sure if there is an automation that has been added that automatically adds a centroid for a new zone, or you might have not deleted the centroid beforehand - also centroids are just stored in the node table and there might be some numbering overlap with your regular nodes. 
6. What is the bike in your profile photo - looks like a sweet steel framed touring bike?



--
You received this message because you are subscribed to the Google Groups "AequilibraE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aequilibrae...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/aequilibrae/da7182d8-6de3-414d-85e5-0d87f330e9bfn%40googlegroups.com.

Tim Klein

unread,
Jan 13, 2026, 3:56:23 AM (6 days ago) Jan 13
to AequilibraE
Hey Jamie,
thanks for the quick reply! I'll answer the easy stuff first:
1) & 2) I'll reduce it later today and do that
3) i ran it from powershell just now, and added some logging after the first attempt, so the "create zone" bit looks like this now:
        # create zones

        i = 0
        for idx, record in df.iterrows():
            #new_zone = zones.new(record['source_id'])
            new_zone = zones.new(i)
            if i > 491: print(new_zone)
            #new_zone = zones.new(idx + 1) # sonst: 'ValueError: Centroid IDs need to be positive'
            # add data (only shows up when the whole script is run twice wtf)

            z_geom = load_wkt(record['geometry'])
            if i > 491: print(z_geom)
            new_zone.geometry = z_geom
            if i > 491: print(new_zone)

            z_centroid = load_wkt(record['centroid'])
            if i > 491: print(z_centroid)
            new_zone.add_centroid(z_centroid)
            if i > 491: print(new_zone)
            new_zone.save()
            if i > 491: print('saved zone', i)
            i += 1
            if i % 100 == 0: print(i, ' zones created, index ', idx)
        zones.save()

The result in the powershell looks like the attached txt. So
- i get 496 zones today
- the script stops working when it should enter the centroid for zone 496
The log ends with:
2026-01-13 09:13:47,417;INFO ; Zone with id 495 was created
2026-01-13 09:13:47,417;INFO ; Zone with id 495 was created
2026-01-13 09:13:47,471;WARNING ; Centroid already exists. Failed to create it
2026-01-13 09:13:47,471;WARNING ; Centroid already exists. Failed to create it
2026-01-13 09:13:47,577;INFO ; Zone with id 496 was created
2026-01-13 09:13:47,577;INFO ; Zone with id 496 was created

4) I opened the database in QGIS (see attached png): It shows the osm-based network, the nodes are classified by "is_centroid" (I am doing a model of pedestrian traffic, which also has bus-stops as origins/destinations - hence the meaningless polygons). I am surprised that the database has 994 centroids; so ...
5) ...  next thing I'll try to throw these out first and see what happens. I thought the centroids dissappear when you delete the zones like
        # delete existing zones
        i = 0
        for z in list(zones.all_zones().keys()):
            zones.get(z).delete()
            i += 1
        print(i, ' zones deleted')
6)  It is indeed - it's my everyday and touring bike cobbled together around an old raleigh frame - now and then i like to deal with tech i can grasp ;)

Best, Tim
Op dinsdag 13 januari 2026 om 00:24:46 UTC+1 schreef Jamie Cook:
Screenshot 2026-01-13 092723.png
260113 ps log build zones.txt

Tim Klein

unread,
Jan 13, 2026, 5:58:50 AM (6 days ago) Jan 13
to AequilibraE
Update: I manually removed the centroids in QGIS (there does not seem to be a .delete() method for nodes). Result: almost identical, less zones created than earlier today; however, the logfile ends like this:
2026-01-13 11:55:51,587;INFO ; Zone with id 324 was created
2026-01-13 11:55:51,587;INFO ; Zone with id 324 was created
2026-01-13 11:55:51,796;INFO ; Zone with id 325 was created
2026-01-13 11:55:51,796;INFO ; Zone with id 325 was created


And my own logging ends after the centroid is entered, so instead of 
<aequilibrae.project.zone.Zone object at 0x000002B42CF6E5A0>
POINT (9.988133 53.581802)
PS C:\Program Files\Python312>
i get:
<aequilibrae.project.zone.Zone object at 0x000001D2F2D88800>
POINT (9.935055 53.551544)
<aequilibrae.project.zone.Zone object at 0x000001D2F2D88800>
PS C:\Program Files\Python312>

btw the extra centroids in the earlier runs must have been remnants of attempts with different ids for the zones.
 best, Tim
Op dinsdag 13 januari 2026 om 09:56:23 UTC+1 schreef Tim Klein:

Tim Klein

unread,
Jan 13, 2026, 11:48:03 AM (6 days ago) Jan 13
to AequilibraE
here's the sample files - the required path structure is more or less obvious from the first lines, should be clear when you search for "my_test_project_folder" as part of the path.
the first script (building the network) takes about 45', the second (zones etc.) stops after 2' or so.
thanks for bothering and good luck!


Op dinsdag 13 januari 2026 om 11:58:50 UTC+1 schreef Tim Klein:
test create zones.zip

Jamie Cook

unread,
Jan 16, 2026, 7:53:46 PM (3 days ago) Jan 16
to Tim Klein, AequilibraE
Hey Tim, 

I've tried running your scripts and don't seem to be replicating the problem you experienced. 
The whole thing did eventually run past the point you mentioned - I haven't fixed all the problems but I did have to make some changes to allow relative paths to work correctly so I've reattached the whole thing to this email for you. 

image.png

I'm using python 3.10.12 with a freshly pulled version of the source from the github repository... which shouldn't be very different to the 1.5.1 you were running. I'm thinking it's something else in your environment that is causing this. 

If you aren't using a virtualenv I would recommend doing that and setting up a fresh clean install.

python -m pip install virtualenv
python -m virtualenv P:\Path_to_venv_to_be_created
P:\Path_to_venv_to_be_created\scripts\activate.bat
python -m pip install uv
python -m uv install aequilibrae matplotlib

You didn't mention what version of python you are using but you could also try updating to a newer version. 



tim-klein.tar.gz

Jake Moss

unread,
Jan 18, 2026, 6:28:17 PM (19 hours ago) Jan 18
to Tim Klein, AequilibraE
Hi Tim,

I've taken a quick look at your code, and I think I know what's going on. The link.save method opens a new connection to the project data every time it is called, this will tank the performance of any loop. To avoid this, the method accepts an optional connection argument [1], you can open it once with with project.db_connection as conn: ... [2] then passing that to link.save(conn) . Another option is to use the Pandas to_sql methods [3] with the connection you obtain from the context manager above, the database triggers will handle most things for you. Just be sure to format the dataframe in the same manner as [4]. 


Hope this helps,
Jake


From: aequi...@googlegroups.com <aequi...@googlegroups.com> on behalf of Jamie Cook <jimi...@gmail.com>
Sent: Saturday, January 17, 2026 10:53 AM
To: Tim Klein <tristram...@gmail.com>
Cc: AequilibraE <aequi...@googlegroups.com>
Subject: Re: aequilibrae 1.5.1 goes AWOL during zone creation
Reply all
Reply to author
Forward
0 new messages