Bug 1932056

Summary: Python3-libs error on fractions.py module
Product: [Fedora] Fedora Reporter: clifford snow <jcs>
Component: python3.9Assignee: Miro Hrončok <mhroncok>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 33CC: cstratak, mhroncok, python-sig, thrnciar, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-23 20:41:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description clifford snow 2021-02-23 20:02:18 UTC
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)

Comment 1 Miro Hrončok 2021-02-23 20:18:03 UTC
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?

Comment 2 Miro Hrončok 2021-02-23 20:41:38 UTC
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