Use existing pyenv Python

I’m new to Platform IO and am trying to set it up with VS Code. I have Python already on my system, but it comes through pyenv-win and not a “vanilla” installation. Is there any way I can tell Platform IO to use the pyenv-win installation instead of downloading its own Python?

Windows 10 Home, Python 3.10.5 (though I don’t mind installing additional versions via pyenv-win for compatibility), latest VS Code stable release.

You can activate your custom existing Python environment / installation and pip install platformio in there, then use the extension settings to point to that custom path.

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.