Bug 2210608 - python-pyswarms: FTBFS in Fedora Rawhide
Summary: python-pyswarms: FTBFS in Fedora Rawhide
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pyswarms
Version: 39
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Iztok Fister Jr.
QA Contact:
URL: https://koschei.fedoraproject.org/pac...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-29 00:22 UTC by Orion Poplawski
Modified: 2023-09-15 18:52 UTC (History)
3 users (show)

Fixed In Version: python-pyswarms-1.3.0-20.fc40 python-pyswarms-1.3.0-20.fc39
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-07 13:07:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github ljvmiranda921 pyswarms issues 508 0 None open Tests fail with Matplotlib 3.7 2023-06-05 13:15:02 UTC
Github ljvmiranda921 pyswarms issues 516 0 None open Test failures 2023-06-25 17:59:39 UTC
Github ljvmiranda921 pyswarms pull 509 0 None open Fix tests with Matplotlib 3.7 2023-06-05 13:15:02 UTC

Description Orion Poplawski 2023-05-29 00:22:10 UTC
Description of problem:
Package python-pyswarms fails to build from source in Fedora Rawhide.

Version-Release number of selected component (if applicable):
1.3.0-13.fc38

Steps to Reproduce:
koji build --scratch f39 python-pyswarms-1.3.0-13.fc38.src.rpm

Additional info:
This package is tracked by Koschei. See:
https://koschei.fedoraproject.org/package/python-pyswarms

Reproducible: Always




____________ ERROR collecting tests/utils/plotters/test_plotters.py ____________
ImportError while importing test module '/builddir/build/BUILD/pyswarms-1.3.0/tests/utils/plotters/test_plotters.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/utils/plotters/test_plotters.py:17: in <module>
    from matplotlib.axes._subplots import SubplotBase
E   ModuleNotFoundError: No module named 'matplotlib.axes._subplots'
------------------------------- Captured stdout --------------------------------
No display found. Using non-interactive Agg backend.
=========================== short test summary info ============================
ERROR tests/utils/plotters/test_plotters.py

Comment 1 Ankur Sinha (FranciscoD) 2023-06-05 13:15:02 UTC
I see an issue and PR have been filed already:

https://github.com/ljvmiranda921/pyswarms/issues/508

https://github.com/ljvmiranda921/pyswarms/pull/509

Iztok: could we carry the patch in the meantime to fix this FTBFS? 

Please let us know if there's anything we can do to help :)

Cheers,

Comment 2 Orion Poplawski 2023-06-25 17:59:39 UTC
I've applied the matplotlib patch, but it still fails:

_ ERROR at setup of TestGeneralOptimizer.test_train_history[optimizer_history0-cost_history-expected_shape0] _
self = <tests.optimizers.test_general_optimizer.TestGeneralOptimizer object at 0xffff6f8dde10>
request = <SubRequest 'optimizer_history' for <Function test_train_history[optimizer_history0-cost_history-expected_shape0]>>
options = {'c1': 0.3, 'c2': 0.7, 'k': 2, 'p': 2, ...}
    @pytest.fixture(params=topologies)
    def optimizer_history(self, request, options):
        opt = GeneralOptimizerPSO(
            n_particles=10,
            dimensions=2,
            options=options,
            topology=request.param,
        )
>       opt.optimize(sphere, 1000)
tests/optimizers/test_general_optimizer.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyswarms/single/general_optimizer.py:252: in optimize
    self.swarm.best_pos, self.swarm.best_cost = self.top.compute_gbest(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <pyswarms.backend.topology.pyramid.Pyramid object at 0xffff6f89ffd0>
swarm = Swarm(position=array([[0.99029359, 0.76531587],
       [0.6685371 , 0.85310907],
       [0.36142089, 0.14341208],
    ...6, 1.17473693, 0.15119209, 0.54211531, 0.53914621,
       0.4226627 , 1.00655433, 0.39733392, 1.45670983, 0.97363041]))
kwargs = {'c1': 0.3, 'c2': 0.7, 'k': 2, 'p': 2, ...}
pyramid = <scipy.spatial._qhull.Delaunay object at 0xffff6f893290>
    def compute_gbest(self, swarm, **kwargs):
        """Update the global best using a pyramid neighborhood approach
    
        This topology uses the :code:`Delaunay` class from :code:`scipy`. To
        prevent precision errors in the Delaunay class, custom
        :code:`qhull_options` were added. Namely, :code:`QJ0.001 Qbb Qc Qx`.
        The meaning of those options is explained in [qhull]. This method is
        used to triangulate N-dimensional space into simplices. The vertices of
        the simplicies consist of swarm particles. This method is adapted from
        the work of Lane et al.[SIS2008]
    
        [SIS2008] J. Lane, A. Engelbrecht and J. Gain, "Particle swarm optimization with spatially
        meaningful neighbours," 2008 IEEE Swarm Intelligence Symposium, St. Louis, MO, 2008,
        pp. 1-8. doi: 10.1109/SIS.2008.4668281
        [qhull] http://www.qhull.org/html/qh-optq.htm
    
        Parameters
        ----------
        swarm : pyswarms.backend.swarms.Swarm
            a Swarm instance
    
        Returns
        -------
        numpy.ndarray
            Best position of shape :code:`(n_dimensions, )`
        float
            Best cost
        """
        try:
            # If there are less than (swarm.dimensions + 1) particles they are all connected
            if swarm.n_particles < swarm.dimensions + 1:
                self.neighbor_idx = np.tile(
                    np.arange(swarm.n_particles), (swarm.n_particles, 1)
                )
                best_pos = swarm.pbest_pos[np.argmin(swarm.pbest_cost)]
                best_cost = np.min(swarm.pbest_cost)
            else:
                # Check if the topology is static or dynamic and assign neighbors
                if (
                    self.static and self.neighbor_idx is None
                ) or not self.static:
                    pyramid = Delaunay(
                        swarm.position, qhull_options="QJ0.001 Qbb Qc Qx"
                    )
                    indices, index_pointer = pyramid.vertex_neighbor_vertices
                    # Insert all the neighbors for each particle in the idx array
>                   self.neighbor_idx = np.array(
                        [
                            index_pointer[indices[i] : indices[i + 1]]
                            for i in range(swarm.n_particles)
                        ]
                    )
E                   ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (10,) + inhomogeneous part.
pyswarms/backend/topology/pyramid.py:81: ValueError


I've filed https://github.com/ljvmiranda921/pyswarms/issues/516

Comment 3 Fedora Release Engineering 2023-08-16 08:09:55 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 4 Fedora Update System 2023-09-07 13:05:09 UTC
FEDORA-2023-a3d20219b2 has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-a3d20219b2

Comment 5 Fedora Update System 2023-09-07 13:07:34 UTC
FEDORA-2023-a3d20219b2 has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2023-09-07 13:38:36 UTC
FEDORA-2023-07edd265b5 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-07edd265b5

Comment 7 Fedora Update System 2023-09-08 01:36:11 UTC
FEDORA-2023-07edd265b5 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-07edd265b5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-07edd265b5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2023-09-15 18:52:52 UTC
FEDORA-2023-07edd265b5 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.


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