The stable release of pyfolio i.e. 0.9.2 is compatible with Python 2.7, 3.4 and 3.5. It hasn't been maintained since 2019.
I would suggest using pyfolio-reloaded which is actively maintained and supports Python 3.9 - 3.12.