Skip to content

net.shortest_paths doesn't work with multiprocessing #176

@lilianmarey

Description

@lilianmarey

Hi,

I'm having a little of trouble trying to use Pandana with multiprocessing

Description of the bug

When I call net.shortest_paths (with an 's') in a multiprocessing process (I use a multiprocessing.Pool object), it doesn't finish like an infinite loop (no error message).
I tested to do the same with net.shortest_path (without an 's') and it worked! However I have to use shortest_paths because it is faster in my case.
I wanted to know if there is an explanation to this.

Network data (optional)

OpenStreetMap Data

Environment

Mac OS 11.2.1
Python 3.9.7
Pandana 0.6.1

Paste the code that reproduces the issue here:

from multiprocessing import Pool

n_cores = 3

def f(n_repet):
return [net.shortest_paths([node_0_id], [node_1_id]) for i in tqdm(range(n_repet))]

p = Pool(n_cores)
a = p.map(f, [10 for i in range(10)])

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions