Install & Compatibility
Where this runs
tested against v0.33.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 8.0s · import 1.516s · 255MB
259MB installed
● package 259MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Louvain
✓ from sknetwork.clustering import Louvain
Common clustering algorithm.
KarateClub
✓ from sknetwork.data import karate_club
Example graph dataset for quick experimentation.
DiffusionClassifier
✓ from sknetwork.classification import DiffusionClassifier
Example of a classification algorithm.
PageRank
✓ from sknetwork.ranking import PageRank
Example of a ranking algorithm.
This quickstart demonstrates how to load a sample graph and apply the Louvain clustering algorithm to detect communities. It prints the number of nodes, a snippet of the assigned labels, and the total number of unique clusters found.
from sknetwork.data import karate_club
from sknetwork.clustering import Louvain
# Load an example graph (Karate Club dataset)
graph = karate_club()
adjacency = graph.adjacency
# Apply Louvain clustering algorithm
louvain = Louvain()
labels = louvain.fit_predict(adjacency)
print(f"Number of nodes: {adjacency.shape[0]}")
print(f"Detected cluster labels (first 10): {labels[:10]}")
print(f"Unique clusters found: {len(set(labels))}")
Debug
Known issues
breakingMajor API changes for clustering, classification, ranking, and GNN algorithms. Methods like `fit_transform` were introduced, and parameter names were changed (e.g., `seeds` to `labels` for classification, `seeds` to `weights` for ranking).fixReview the documentation for `sknetwork.clustering`, `sknetwork.classification`, `sknetwork.ranking`, and `sknetwork.gnn` modules. Update method calls and parameter names to match the new API (e.g., use `fit_predict` or `fit_transform`).
affects: 0.29.0 and later
breakingThe parameter `membership` was renamed to `probs` in soft classification and clustering algorithms.fixIf you were using the `membership` parameter in soft classification or clustering algorithms, update your code to use `probs` instead.
affects: 0.31.0 and later
breakingSupport for older Python versions has been dropped. Python 3.9 was dropped in 0.33.5, and Python 3.8 was dropped in 0.33.0.fixEnsure your Python environment is running version 3.10 or newer. Upgrade your Python interpreter if necessary to use the latest scikit-network versions.
affects: 0.33.0 and later
deprecatedThe 'hierarchical Louvain embedding' feature was removed.fixIf your application relied on hierarchical Louvain embedding, you will need to find an alternative approach or algorithm for hierarchical graph analysis, as this specific feature is no longer available.
affects: 0.32.1 and later
deprecatedFirst-order methods for link prediction were removed.fixMigrate to newer link prediction methods provided by the library, such as nearest neighbor methods, which were introduced alongside this change. Consult the `sknetwork.link_prediction` module documentation.
affects: 0.29.0 and later
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'sknetwork'
The 'scikit-network' library has not been installed in the current Python environment.
fixpip install scikit-network
AttributeError: 'Louvain' object has no attribute 'labels_'
The 'labels_' attribute, which stores the clustering results, is only available after the 'fit' or 'fit_transform' method of the Louvain algorithm has been called.
fixlouvain_algorithm.fit(adjacency_matrix) # Then access louvain_algorithm.labels_
TypeError: Argument 'adjacency' must be a scipy.sparse.csr_matrix
Scikit-network algorithms generally expect the input adjacency matrix to be a SciPy sparse matrix (e.g., csr_matrix or coo_matrix), but a dense NumPy array or another incompatible type was provided.
fixfrom scipy.sparse import csr_matrix; adjacency = csr_matrix(dense_numpy_array)
ValueError: Adjacency matrix must be square.
The input adjacency matrix provided to a graph algorithm must have an equal number of rows and columns, representing a square graph.
fixEnsure your input matrix 'adjacency_matrix' has 'adjacency_matrix.shape[0] == adjacency_matrix.shape[1]'.
Upgrade
Version history
0.33.5latest on PyPI · released Nov 19, 2025
Audit
Dependencies
numpyrequiredCore dependency for numerical operations, graph representation.
scipyrequiredCore dependency for sparse matrix operations and scientific computing.