Description of problem: Originally found trying to import NetworkX python module. The error is from the fractions module Version-Release number of selected component (if applicable): python3-libs-3.9.1-2.fc33.x86_64 How reproducible: Always Steps to Reproduce: 1.run python 2.enter "from fractions import gcd" 3. Actual results: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib64/python3.9/fractions.py) Expected results: Loads module Additional info: I was attempting to understand why a QGIS plugin would not run. It was failing when importing the NetworkX module. For example: >>> import networkx as nx Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/clifford/.local/lib/python3.9/site-packages/networkx/__init__.py", line 84, in <module> import networkx.generators File "/home/clifford/.local/lib/python3.9/site-packages/networkx/generators/__init__.py", line 5, in <module> from networkx.generators.classic import * File "/home/clifford/.local/lib/python3.9/site-packages/networkx/generators/classic.py", line 21, in <module> from networkx.algorithms.bipartite.generators import complete_bipartite_graph File "/home/clifford/.local/lib/python3.9/site-packages/networkx/algorithms/__init__.py", line 12, in <module> from networkx.algorithms.dag import * File "/home/clifford/.local/lib/python3.9/site-packages/networkx/algorithms/dag.py", line 2, in <module> from fractions import gcd ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib64/python3.9/fractions.py)
Yes, there is no such function there. https://docs.python.org/3.9/whatsnew/changelog.html bpo-39350: Remove fractions.gcd() function, deprecated since Python 3.5 (bpo-22486): use math.gcd() instead. https://bugs.python.org/issue39350 Where do you get networkx from? Fedora or pip?
Oh, I see: /home/clifford/.local/lib/python3.9/site-packages/networkx/__init__.py Nothing Fedora can do here. This was fixed in networkx 2.4+: https://github.com/networkx/networkx/commit/b007158f3bfbcf77c52e4b39a81061914788ddf9