Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: exception: stack overflow (Appears during clean_network) #35

Open
jobelanger opened this issue Aug 13, 2021 · 9 comments
Open

Comments

@jobelanger
Copy link

Received this error when running clean_network on a large graph. In my case I was using it for country-level datasets in Mali and Burkina Faso, running on a Windows 10 machine. My current workaround as suggested by @d3netxer is to skip the cleaning function altogether.
oserror_stack_overflow

@d3netxer
Copy link
Contributor

I'm doing some work on my horn of africa analysis. I believe that totally skipping the cleaning is why I had trouble getting O-D routes. Missing reflected edges still need to be added. I'm trying to run this separately:

G_full = gn.add_missing_reflected_edges(G)

will provide update...

@gracedoherty
Copy link

@d3netxer Any update on this issue? I'm getting the same error. I was going to run clean_network, then salt_long_lines, then proceed with the time-based OD creation. Sounds like we shouldn't be skipping the clean_network function if so?

I'm using the latest Africa osm pbf and clipping it to a buffered border of Senegal & The Gambia.

@d3netxer
Copy link
Contributor

no, you don’t want to skip cleaning the network. But you can try running simplify junctions and adding missing reflected edges separately, and see if this works.

@gracedoherty
Copy link

gracedoherty commented Nov 29, 2021

Okay, thanks. simplify_junctions is the point where the stack overflow error prints. Other issues cropped up for me when I removed it from the .py file. I ran an abbreviated version of the function and it completed. I included:

  • add_missing_reflected_edges()
  • custom_simplify() # the second iteration
  • convert_to_MultiDiGraph()
  • add_missing_reflected_edges()

And I removed the following:

  • simplify_junctions() # Stack overflow error.
  • custom_simplify() # the first iteration
  • remove_duplicate_edges # I forgot to document what line this was happening, but for either custom simplify or remove duplicate edges, the kernel stalls and never finishes (still "running" even overnight).
    image

@jwrap
Copy link

jwrap commented Feb 27, 2022

I'm working on the OSM network for Cabo Verde (downloaded from Geofabrik) and ran into the same issue. I managed to resolve it by modifying the simplify_junctions function as follows:

image

  1. not sure why but attempting to change the crs of gdfnodes simply changed my geometries to POINT (inf inf)
  2. unary_union was causing the stack overflow, so i used the geometry after passing .dissolve() instead

Further down the line I see that the custom_simplify function tries to call "ConvertToMultiDiGraph" instead of "convert_to_MultiDiGraph" so i fixed that too.

image

Now the clean_network function seems to work well for me. Hope this helps!

@d3netxer
Copy link
Contributor

d3netxer commented Mar 1, 2022

Thanks @jwrap for your comments. Here are some responses:

  • I would like to drill down why the attempting to change the crs didn't work for you. Do you know the which measure_crs you used? Also the projection/coordinates of you graph?
  • I do recall isolating the stack_overflow() error to the unary_union code. It tends to pop-up in very large graphs. This seems like a great way to get around it is using the Geopandas dissolve function you found? I didn't know about that.
  • The current master branch does have the up-to-date convert_to_MultiDiGraph function. I recommend you uninstall GOSTnets, then pull the master branch and reference it in your code.

@Charlesfox1
Copy link
Contributor

Charlesfox1 commented Mar 1, 2022 via email

@d3netxer
Copy link
Contributor

d3netxer commented Mar 1, 2022

Interesting, you got me thinking now Charles...maybe Dask can be used. I'm reading there is a dask-geopandas, I never tried that before; but I want to try that now, I'm making a mental note.

@Charlesfox1
Copy link
Contributor

Charlesfox1 commented Mar 1, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants