You can post-install arbitrary python package in PlatformIO’s virtualenv environment as long as they don’t have conflicting dependencies with something else (in which case, you would need to create a new virtual environement, which is something that the ESP-IDF builder script does).
Thus, duplicate of How to use own python libraries in extra_script.py - #2 by maxgerhardt.