How to add python modules to your KiCad install
If you are a KiCad python script developer you may have cause to use a module that KiCad isn’t including in their python distribution. You can’t ship plugins that depend on modules not present in the KiCad package, but you can use them locally.
I’m working on some performance optimizations to the kicad-jlcpcb-tools plugin and I’d like to make use of viztracer to help optimize during development.
Python modules can be installed via pip, but you have to use the KiCad packaged python.
On OSX with KiCad 7.x I did the below in a terminal:
cd /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/bin
./python3 pip3 install viztracer
Of course paths will differ depending on the KiCad version being used, the OS, and the version of Python bundled with KiCad.