pyswarms
A Python-based Particle Swarm Optimization (PSO) library.
Decision gist · record as of 2026-08-14
Yes, if you are doing research, education, or prototyping with particle swarm optimization. The low install friction, permissive MIT license, and extensible design make it a solid choice for PSO work. However, be aware that the package is dormant—the latest release is from 2021-01-03, so compatibility with very recent Python or dependency versions is uncertain. Not recommended for production systems requiring active maintenance and support.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a pure-Python wheel distribution.
- Maintenance is dormant—the latest release was 2021-01-03, though the repository remains active with a recent commit on 2024-08-06 and 1393 stars.
- Suitable for research and educational use but not actively developed.
License · maintenance · safety
MIT license (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution. Safe for commercial and open-source projects alike.
last release 2021-01-03 (2049 days) · last repo commit 2024-08-06 · 1,393 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 74,825 downloads/mo, #14,788 on PyPI
Alternatives
Verify before relying
pip install pyswarms
import pyswarms as ps
from pyswarms.utils.functions import single_obj as fx
options = {'c1': 0.5, 'c2': 0.3, 'w': 0.9}
optimizer = ps.single.GlobalBestPSO(n_particles=10, dimensions=2, options=options)
best_cost, best_pos = optimizer.optimize(fx.sphere, iters=100)- Whether the package works reliably with Python versions beyond 3.7 (classifiers list only 3.6 and 3.7 explicitly)
- Current compatibility with modern scipy and numpy versions given dormant maintenance status since 2021-01-03
What it is and what it does
PySwarms is a research toolkit for particle swarm optimization (PSO) that provides ready-to-use implementations of PSO algorithms alongside utilities for hyperparameter tuning, visualization, and testing. It wraps scipy, numpy, and matplotlib to deliver a declarative interface where you define an objective function, configure swarm parameters, and run the optimizer to find minima or maxima across your problem space.
The package targets researchers, students, and practitioners who want to apply PSO without building the algorithm from scratch. It includes built-in test functions, grid and random search tools for hyperparameter optimization, and plotting utilities to visualize cost histories and particle trajectories. The API is extensible, allowing researchers to implement custom PSO variants. Dependencies are standard scientific Python libraries (scipy, numpy, matplotlib, attrs, tqdm, pyyaml, future), making it straightforward to integrate into existing workflows.
Use it for
- Solve unconstrained continuous optimization problems where gradient-free metaheuristic search is preferred over calculus-based methods.
- Tune hyperparameters of a PSO optimizer using built-in grid or random search to find the best configuration for your objective function.
- Visualize swarm behavior and cost convergence over iterations using the plotting module to understand optimizer performance and debug tuning choices.
- Implement custom PSO variants or hybrid algorithms by extending the toolkit's base classes for research publications or specialized applications.
- Benchmark PSO against other metaheuristics on standard test functions provided in the utils module.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are doing research, education, or prototyping with particle swarm optimization.
The low install friction, permissive MIT license, and extensible design make it a solid choice for PSO work. However, be aware that the package is dormant—the latest release is from 2021-01-03, so compatibility with very recent Python or dependency versions is uncertain. Not recommended for production systems requiring active maintenance and support.
Install
pyswarms on PyPI
Before you install
Low install friction with a pure-Python wheel distribution. Maintenance is dormant—the latest release was 2021-01-03, though the repository remains active with a recent commit on 2024-08-06 and 1393 stars. Suitable for research and educational use but not actively developed.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution. Safe for commercial and open-source projects alike.
Quickstart
pip install pyswarms
import pyswarms as ps
from pyswarms.utils.functions import single_obj as fx
options = {'c1': 0.5, 'c2': 0.3, 'w': 0.9}
optimizer = ps.single.GlobalBestPSO(n_particles=10, dimensions=2, options=options)
best_cost, best_pos = optimizer.optimize(fx.sphere, iters=100)
Verify before relying
- Whether the package works reliably with Python versions beyond 3.7 (classifiers list only 3.6 and 3.7 explicitly)
- Current compatibility with modern scipy and numpy versions given dormant maintenance status since 2021-01-03
Package facts
| License | MIT license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 7 packagesscipynumpymatplotlibattrstqdmfuturepyyaml |
| Maintenance | Dormant 2,049 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 74,825 / month, #14,788 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Mathematics |
Evidence: pyswarms-1.3.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “particle swarm optimization”
- pyswarmsPySwarms implements particle swarm optimization (PSO) algorithms in…
- deapDEAP is an evolutionary computation framework for implementing…
- langgraph-swarmBuilds multi-agent swarm systems where specialized agents hand off…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also pytorch_optimizer · deap · cmaes · pymoo · scikit-fuzzy · optax · pyomo · torch-optimizer · docplex · dopamine-rl