brooksandrew / postman_problems

Graph optimization solvers for the Postman Problems
MIT License
61 stars 31 forks source link

Python 3.9 Compatability issue #71

Open KWolfe81 opened 8 months ago

KWolfe81 commented 8 months ago

I'm getting the following error:

File "c:\python39\lib\site-packages\postman_problems\postman_chinese.py", line 1, in from postman_problems.postman_template import generic_postman File "c:\python39\lib\site-packages\postman_problems\postman_template.py", line 4, in from postman_problems.solver import cpp, rpp File "c:\python39\lib\site-packages\postman_problems\solver.py", line 3, in import networkx as nx File "c:\python39\lib\site-packages\networkx__init.py", line 114, in import networkx.generators File "c:\python39\lib\site-packages\networkx\generators\init.py", line 6, in from networkx.generators.classic import * File "c:\python39\lib\site-packages\networkx\generators\classic.py", line 26, in from networkx.algorithms.bipartite.generators import complete_bipartite_graph File "c:\python39\lib\site-packages\networkx\algorithms\init__.py", line 16, in from networkx.algorithms.dag import * File "c:\python39\lib\site-packages\networkx\algorithms\dag.py", line 14, in from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (c:\python39\lib\fractions.py)

Potentially compatibility issue in the networkx lib?

https://stackoverflow.com/questions/66174862/import-error-cant-import-name-gcd-from-fractions

andrewbrooks-o commented 8 months ago

Thanks for reporting this. I'll admit this lib hasn't received the love it deserves in terms of maintenance. The core of it was developed ~2016 a few years before Python 3.9 was released in 2020.

I'm not sure when I'll get around to adding proper support for the most recent Python and networkx versions. But I'm happy to review PRs if you want to take a stab at it!