Home · Comparisons

PyPortfolioOpt vs Riskfolio-Lib vs skfolio: which portfolio optimization library?

Published 11 Oct 2026 · repository data refreshes daily

Short answer. All three are maintained and permissively licensed, so the choice is about how you work. Use PyPortfolioOpt to get from a price table to an allocation quickly. Use Riskfolio-Lib when the risk measure itself is the question. Use skfolio when you want to cross-validate and tune a portfolio model the way you would any scikit-learn estimator.

Side by side

ToolGitHub starsLast activityLicenceBuilt onStands out for
PyPortfolioOpt6.1k7 Jul 2026MITcvxpyClassical methods with a short path from prices to share counts
Riskfolio-Lib4.5k4 Oct 2026BSD-3-ClauseCVXPY, pandasThe widest choice of risk measures
skfolio2.5k10 Oct 2026BSD-3-Clausescikit-learnCross-validation and model selection for portfolios

Stars and last activity (the most recent push GitHub reports for the repository) come from our daily snapshots and can lag by a few days. Licence and scope were checked against each repository on 11 Oct 2026.

PyPortfolioOpt: the shortest path to an allocation

PyPortfolioOpt is the oldest of the three and the one most tutorials use. It implements the classical toolkit: mean-variance optimization on the efficient frontier, Black-Litterman allocation, covariance shrinkage and Hierarchical Risk Parity, plus mean-semivariance and mean-CVaR optimizers and the critical line algorithm.

Its practical strength is the last step. After optimizing, it can convert continuous weights into a number of shares to buy for a given portfolio size, which is the part many libraries leave to you. The README describes its audience as casual investors and professionals who want an easy prototyping tool, and that is accurate: you can be productive in an afternoon.

The trade-off is scope. You get a well-chosen set of standard methods rather than a broad catalogue of risk measures, and model validation is up to you.

Riskfolio-Lib: when the risk measure matters

Riskfolio-Lib is built on CVXPY and integrates closely with pandas. Where PyPortfolioOpt gives you a handful of objectives, Riskfolio-Lib lets you optimize against more than twenty convex risk measures, grouped into dispersion measures, downside measures such as CVaR and Entropic Value at Risk, and drawdown measures such as Conditional Drawdown at Risk and the Ulcer Index.

It also covers risk parity, hierarchical methods (HRP and Hierarchical Equal Risk Contribution), several Black-Litterman variants, entropy pooling, and constraints on tracking error, turnover and the number of assets. For large problems it can use commercial solvers such as MOSEK or Gurobi, and it can produce reports in Jupyter and Excel.

The cost is a steeper learning curve and a heavier dependency list. You should be comfortable with convex optimization ideas to use it well. It requires Python 3.10 or later.

skfolio: portfolio models you can cross-validate

skfolio is the newest, first published in late 2023, and it is built on scikit-learn. Portfolio models are estimators with the familiar fit and predict interface, so they plug into pipelines, grid search and randomized search without glue code.

That design targets a real weakness of classical optimization: results that look good in sample and fall apart out of sample. skfolio ships walk-forward and combinatorial purged cross-validation, alongside models that range from naive allocations (equal-weighted, inverse-volatility) through mean-risk, risk budgeting and maximum diversification to hierarchical methods and stacking.

It requires Python 3.10 or later and expects you to be at home in the scikit-learn way of working. The project is backed by a company, Skfolio Labs, that sells enterprise support; the library itself is BSD-licensed.

How to choose

They are not mutually exclusive. A common pattern is to prototype in PyPortfolioOpt and move to one of the other two once the question becomes "which risk measure" or "does this hold up out of sample".

None of these libraries tells you what to buy. They turn your assumptions about returns and risk into weights, and the output is only as good as those assumptions.