Bug 1932056 - Python3-libs error on fractions.py module
Summary: Python3-libs error on fractions.py module
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.9
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-23 20:02 UTC by clifford snow
Modified: 2021-02-23 20:41 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-02-23 20:41:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.