If you do a pip install in the MacOS terminal, that will add it to the Python 2.7 libraries, as that is what MacOS is using. When installing PlatformIO via VSCode, it brings its own self-contained Python3 environment which is separate from the system environment. The libs installed by your system’s pip will not be seen there.
The recommended way to install additional Python dependencies is to attempt an import, and if that fails, call into $PYTHONEXE -m pip install <package> to install it. This is showcased e.g. in
and you should add the same style of code in your extra script.
For a more direct way, you can also go into your home directory (/Users/<user> on Mac, idk?) and from there into the .platformio folder. Search this folder for the pip3 executable. Once you find its path, use this pip3 executable to execute the install command, and it will be installed. This is then however not well reproducable accross computers because every user of your extra script will have to do this too; Prefer the first method instead.
Ehm well that’s new one for me. pip internall error. Does it only do that when you install that library? Does it go away with a .. -m pip uninstall postpro? The way you install it seems right to me if that python path is your $PYTHONEXE.
As a very experimental try, maybe updating pip helps? /Users/dirk/.platformio/python3/bin/python3.8 -m pip install --upgrade pip