Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1919869

Summary: python-networkx fails to build with Python 3.10: yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object:networkx.classes.multigraph.MultiGraph'
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-networkxAssignee: Jerry James <loganjerry>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: loganjerry, mhroncok, plautrba, thrnciar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-networkx-2.5-3.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-26 17:56:18 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:
Bug Depends On:    
Bug Blocks: 1890881    

Description Tomáš Hrnčiar 2021-01-25 10:22:02 UTC
python-networkx fails to build with Python 3.10.0a4.

=================================== FAILURES ===================================
___________________________ TestYaml.testUndirected ____________________________

self = <networkx.readwrite.tests.test_yaml.TestYaml object at 0x7f57aad7f550>

    def testUndirected(self):
>       self.assert_equal(self.G, data=False)

networkx/readwrite/tests/test_yaml.py:44: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
networkx/readwrite/tests/test_yaml.py:35: in assert_equal
    Gin = nx.read_yaml(fname)
<decorator-gen-682>:2: in read_yaml
    ???
networkx/utils/decorators.py:239: in _open_file
    result = func_to_be_decorated(*new_args, **kwargs)
networkx/readwrite/nx_yaml.py:91: in read_yaml
    G = yaml.load(path, Loader=yaml.FullLoader)
/usr/lib64/python3.10/site-packages/yaml/__init__.py:114: in load
    return loader.get_single_data()
/usr/lib64/python3.10/site-packages/yaml/constructor.py:51: in get_single_data
    return self.construct_document(node)
/usr/lib64/python3.10/site-packages/yaml/constructor.py:55: in construct_document
    data = self.construct_object(node)
/usr/lib64/python3.10/site-packages/yaml/constructor.py:100: in construct_object
    data = constructor(self, node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <yaml.loader.FullLoader object at 0x7f57aad7fd00>
node = MappingNode(tag='tag:yaml.org,2002:python/object:networkx.classes.graph.Graph', value=[(ScalarNode(tag='tag:yaml.org,2...=[])), (ScalarNode(tag='tag:yaml.org,2002:str', value='g'), MappingNode(tag='tag:yaml.org,2002:map', value=[]))]))]))])

    def construct_undefined(self, node):
>       raise ConstructorError(None, None,
                "could not determine a constructor for the tag %r" % node.tag,
                node.start_mark)
E       yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object:networkx.classes.graph.Graph'
E         in "/tmp/tmpkqn21u1g", line 1, column 1

/usr/lib64/python3.10/site-packages/yaml/constructor.py:427: ConstructorError
____________________________ TestYaml.testDirected _____________________________

self = <networkx.readwrite.tests.test_yaml.TestYaml object at 0x7f579f4f70d0>

    def testDirected(self):
>       self.assert_equal(self.DG, data=False)

networkx/readwrite/tests/test_yaml.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
networkx/readwrite/tests/test_yaml.py:35: in assert_equal
    Gin = nx.read_yaml(fname)
<decorator-gen-682>:2: in read_yaml
    ???
networkx/utils/decorators.py:239: in _open_file
    result = func_to_be_decorated(*new_args, **kwargs)
networkx/readwrite/nx_yaml.py:91: in read_yaml
    G = yaml.load(path, Loader=yaml.FullLoader)
/usr/lib64/python3.10/site-packages/yaml/__init__.py:114: in load
    return loader.get_single_data()
/usr/lib64/python3.10/site-packages/yaml/constructor.py:51: in get_single_data
    return self.construct_document(node)
/usr/lib64/python3.10/site-packages/yaml/constructor.py:55: in construct_document
    data = self.construct_object(node)
/usr/lib64/python3.10/site-packages/yaml/constructor.py:100: in construct_object
    data = constructor(self, node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <yaml.loader.FullLoader object at 0x7f57a8522f10>
node = MappingNode(tag='tag:yaml.org,2002:python/object:networkx.classes.digraph.DiGraph', value=[(ScalarNode(tag='tag:yaml.o...l.org,2002:str', value='node_dict_factory'), ScalarNode(tag='tag:yaml.org,2002:python/name:builtins.dict', value=''))])

    def construct_undefined(self, node):
>       raise ConstructorError(None, None,
                "could not determine a constructor for the tag %r" % node.tag,
                node.start_mark)
E       yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object:networkx.classes.digraph.DiGraph'
E         in "/tmp/tmpx2psee5e", line 1, column 1

/usr/lib64/python3.10/site-packages/yaml/constructor.py:427: ConstructorError
___________________________ TestYaml.testMultiGraph ____________________________

self = <networkx.readwrite.tests.test_yaml.TestYaml object at 0x7f57a8512dc0>

    def testMultiGraph(self):
>       self.assert_equal(self.MG, data=True)

networkx/readwrite/tests/test_yaml.py:50: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
networkx/readwrite/tests/test_yaml.py:35: in assert_equal
    Gin = nx.read_yaml(fname)
<decorator-gen-682>:2: in read_yaml
    ???
networkx/utils/decorators.py:239: in _open_file
    result = func_to_be_decorated(*new_args, **kwargs)
networkx/readwrite/nx_yaml.py:91: in read_yaml
    G = yaml.load(path, Loader=yaml.FullLoader)
/usr/lib64/python3.10/site-packages/yaml/__init__.py:114: in load
    return loader.get_single_data()
/usr/lib64/python3.10/site-packages/yaml/constructor.py:51: in get_single_data
    return self.construct_document(node)
/usr/lib64/python3.10/site-packages/yaml/constructor.py:55: in construct_document
    data = self.construct_object(node)
/usr/lib64/python3.10/site-packages/yaml/constructor.py:100: in construct_object
    data = constructor(self, node)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <yaml.loader.FullLoader object at 0x7f57a8512730>
node = MappingNode(tag='tag:yaml.org,2002:python/object:networkx.classes.multigraph.MultiGraph', value=[(ScalarNode(tag='tag:...l.org,2002:str', value='node_dict_factory'), ScalarNode(tag='tag:yaml.org,2002:python/name:builtins.dict', value=''))])

    def construct_undefined(self, node):
>       raise ConstructorError(None, None,
                "could not determine a constructor for the tag %r" % node.tag,
                node.start_mark)
E       yaml.constructor.ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/object:networkx.classes.multigraph.MultiGraph'
E         in "/tmp/tmpbbk5o523", line 1, column 1

/usr/lib64/python3.10/site-packages/yaml/constructor.py:427: ConstructorError
=============================== warnings summary ===============================
networkx/algorithms/centrality/tests/test_betweenness_centrality.py::TestBetweennessCentrality::test_sample_from_P3
networkx/algorithms/centrality/tests/test_betweenness_centrality.py::TestBetweennessCentrality::test_sample_from_P3
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/algorithms/centrality/betweenness.py:123: DeprecationWarning: Sampling from a set deprecated
  since Python 3.9 and will be removed in a subsequent version.
    nodes = seed.sample(G.nodes(), k)

networkx/algorithms/tests/test_triads.py: 100 warnings
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/algorithms/tests/test_triads.py:39: DeprecationWarning: Sampling from a set deprecated
  since Python 3.9 and will be removed in a subsequent version.
    nodes = sample(G.nodes(), 3)

networkx/algorithms/tests/test_triads.py: 100 warnings
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/algorithms/triads.py:380: DeprecationWarning: Sampling from a set deprecated
  since Python 3.9 and will be removed in a subsequent version.
    nodes = sample(G.nodes(), 3)

networkx/generators/tests/test_directed.py: 10 warnings
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/generators/directed.py:370: DeprecationWarning: Sampling from a set deprecated
  since Python 3.9 and will be removed in a subsequent version.
    return seed.sample(nodes, k)

networkx/generators/tests/test_internet_as_graphs.py: 21 warnings
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/generators/internet_as_graphs.py:313: DeprecationWarning: Sampling from a set deprecated
  since Python 3.9 and will be removed in a subsequent version.
    j = self.seed.sample(node_options, 1)[0]

networkx/generators/tests/test_random_graphs.py: 4830 warnings
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/generators/random_graphs.py:226: DeprecationWarning: Float arguments to randrange() have been deprecated
  since Python 3.10 and will be removed in a subsequent version.
    if seed.randrange(mmax - t) < m - k:

networkx/readwrite/tests/test_graphml.py::TestWriteGraphML::test_numpy_float
networkx/readwrite/tests/test_graphml.py::TestXMLGraphML::test_numpy_float
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/readwrite/tests/test_graphml.py:1144: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. Use `float` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.float_` here.
    wt = np.float(3.4)

networkx/tests/test_convert_numpy.py::TestConvertNumpy::test_from_numpy_matrix_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:118: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. Use `float` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.float_` here.
    A = np.matrix([[1]]).astype(np.float)

networkx/tests/test_convert_numpy.py::TestConvertNumpy::test_from_numpy_matrix_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:122: DeprecationWarning: `np.str` is a deprecated alias for the builtin `str`. Use `str` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.str_` here.
    A = np.matrix([[1]]).astype(np.str)

networkx/tests/test_convert_numpy.py::TestConvertNumpy::test_from_numpy_matrix_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:126: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. Use `bool` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.bool_` here.
    A = np.matrix([[1]]).astype(np.bool)

networkx/tests/test_convert_numpy.py::TestConvertNumpy::test_from_numpy_matrix_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:130: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. Use `complex` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.complex_` here.
    A = np.matrix([[1]]).astype(np.complex)

networkx/tests/test_convert_numpy.py::TestConvertNumpy::test_from_numpy_matrix_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:134: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. Use `object` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.object_` here.
    A = np.matrix([[1]]).astype(np.object)

networkx/tests/test_convert_numpy.py::TestConvertNumpyArray::test_from_numpy_array_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:320: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. Use `float` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.float_` here.
    A = np.array([[1]]).astype(np.float)

networkx/tests/test_convert_numpy.py::TestConvertNumpyArray::test_from_numpy_array_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:324: DeprecationWarning: `np.str` is a deprecated alias for the builtin `str`. Use `str` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.str_` here.
    A = np.array([[1]]).astype(np.str)

networkx/tests/test_convert_numpy.py::TestConvertNumpyArray::test_from_numpy_array_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:328: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. Use `bool` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.bool_` here.
    A = np.array([[1]]).astype(np.bool)

networkx/tests/test_convert_numpy.py::TestConvertNumpyArray::test_from_numpy_array_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:332: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. Use `complex` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.complex_` here.
    A = np.array([[1]]).astype(np.complex)

networkx/tests/test_convert_numpy.py::TestConvertNumpyArray::test_from_numpy_array_type
  /builddir/build/BUILD/networkx-networkx-2.5/networkx/tests/test_convert_numpy.py:336: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. Use `object` by itself, which is identical in behavior, to silence this warning. If you specifically wanted the numpy scalar type, use `np.object_` here.
    A = np.array([[1]]).astype(np.object)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED networkx/readwrite/tests/test_yaml.py::TestYaml::testUndirected - yaml...
FAILED networkx/readwrite/tests/test_yaml.py::TestYaml::testDirected - yaml.c...
FAILED networkx/readwrite/tests/test_yaml.py::TestYaml::testMultiGraph - yaml...
= 3 failed, 4073 passed, 9 skipped, 2 xfailed, 5075 warnings in 109.36s (0:01:49) =

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01899598-python-networkx/

For all our attempts to build python-networkx with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-networkx/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Jerry James 2021-01-25 22:21:19 UTC
This has nothing to do with python 3.10, but rather is due to the fix for CVE-2020-14343 in python3-pyyaml 5.4+.

Comment 2 Jerry James 2021-01-26 17:56:18 UTC
Upstream had already committed a fix for this issue, so I have applied their patch to the Fedora package.  It has been built in Rawhide.  I will need to backport that fix to Fedora 33 as well, since python3-pyyaml 5.4.1 is the current version there.