Use existing pyenv Python

Thanks a lot for your help! This solution worked, though I ended up using a venv instead of the global Python from pyenv.


For anyone trying this in the future, here are some things I screwed up (as a newbie to Platform IO):

  • The VS Code setting platformio-ide.customPATH takes the path of a folder, not an executable. For a venv, it’s \\path\\to\\venv\\Scripts (backslash and escape convention as per Windows).
  • At one point, the system produced an error that it was unable to open a certain scons.py. This solution worked: Unable to create new project in Core 5.1.0 (SCons Error message).
  • When uploading code, it initially seemed to be stuck with the message uploading .pio\build\uno\firmware.hex. The problem was apparently that the COM port was busy (I’m guessing from when I earlier tested that the vanilla Arduino IDE, v2.0.0-rc9.2, has installed the required drivers and I can upload code). The fastest fix for this is to unplug and re-plug the Arduino via USB. Solution source: Arduino Nano Stuck Uploading.
  • I was annoyed by syntax highlighting+Intellisense for a long time as it couldn’t find the standard libraries of Arduino. My solution (based on a hunch) was to delete the .vscode folder (and hence .vscode\c_cpp_properties.json) and restart VS Code.