Specify Path to PlatformIO in Visual Studio Code

I am attempting to construct a “portable” Visual Studio Code/ PlatformIO, placing Python 27 and the platformIO script in folders along with Visual Studio Code’ non-install .zip version. I want to avoid having to set path system variable. (to be able to use without admin rights)

I am able to initialize a project src folder right in the Python27\Scripts folder, but of course, this is not ideal.

Is there a way to point PlatformIO path in Visual Studio Code settings?
thanks

We released Official PlatformIO IDE for VSCode yesterday.

See platformio-ide.customPATH in extension settings. You configuration should look like:

  1. platformio-ide.useBuiltinPIOCore = false
  2. platformio-ide.customPATH = /path/to/pio/folder where platformio.exe is located.
1 Like

Hi - So sorry to disturb with this simple question. I am still not familiar with platformIO, but I have allready spend several hours trying to get away from the C-drive (nearly full). I need to install on E:\projects…
I can’t figure out how to set platformio-ide.useBuiltinPIOCore = false and the corresponding path ( platformio-ide.customPATH = /path/to/pio/folderwhereplatformio.exe` is located.)
I tried to open a new terminal in platformIO but receives this answer:
ObjectNotFound: (platformio-ide.customPATH:String) [], CommandNotFoundException
I also tried to navigate to the C:\Users\Steen.platformio\penv\Scripts> - where the platformIO.exe is placed - same result.
I would be VERY happy to have some help… :joy:

The core must pre-exist at that path, it doesn’t move the core there to the folder you specify, it looks for it there. To change the PlatformIO installation path, see VSCode Install directory - #2 by binux and docs.

Hi Max (just Max - OK?)
Thanks for a very swift answer… I try to do and have read what you want me to do.
However it will not work for me.
Everytime I try to install PlatformIO extension inside VS-code it installs in my user path: C:\Users\Steen.platformio\penv\Scripts\platformio.exe run. I want it to install on E:\ESP32-IDF and my project in E:\ESP32-projects.

My platformIO.ini is: (all comments tried)

platformio-ide.useBuiltinPIOCore = false
//PLATFORMIO_CORE_DIR = E:\ESP32-IDF
PLATFORMIO_CORE_DIR = C:\Users\Steen\.platformio\penv\Scripts
//platformio-ide.customPATH = E:\ESP32-IDF
// platformio-ide.customPATH = C:\Users\Steen\.platformio\penv\Scripts

and the result is:

> Executing task in folder DP2001WiFi: C:\Users\Steen\.platformio\penv\Scripts\platformio.exe run <

Warning! Ignore unknown configuration option `platformio-ide.usebuiltinpiocore` in section [env:esp-wrover-kit]
Warning! Ignore unknown configuration option `//platformio_core_dir` in section [env:esp-wrover-kit]
Warning! Ignore unknown configuration option `platformio_core_dir` in section [env:esp-wrover-kit]
Warning! Ignore unknown configuration option `//platformio-ide.custompath` in section [env:esp-wrover-kit]
Warning! Ignore unknown configuration option `// platformio-ide.custompath` in section [env:esp-wrover-kit]

all the best Steen

  1. The comment character in an .ini file is ; or #, not //
  2. The documentation I linked you to refers to PLATFORMIO_CORE_DIR as an Environment variable. Not a per-project platformio.ini option, you can’t put it in there. (that would be core_dir, but this is not what you want when you want this setting globally). You need to uninstall PlatformIO again, then add a system environment variable with name PLATFORMIO_CORE_DIR with the value being the path you want.

Once the environment variable has been set, restart VSCode and re-install PlatformIO. It should respect this path now.

Well when you chose this path you’ll have E:\ESP32-IDF\.platformio\<all platformio stuff> and not only “ESP32-IDF” stuff, but okay, you chose the name :smiley:

Hi again - thanks for hanging on
I don’t know if my next question belongs here? I am still in trouble. :rofl:
Thanks for the comment char in the .ini-file
OK - environment set to E\ESP32 (your point taken), VS-code reinstalled, Python reinstalled, PlatformIO extension reinstalled - in that order.
BUT - the PIO Home-button does not show up…? Picture of my path included…

Oh I see it didn’t create a .platformio subfolder in ESP32 but put everything directly in there – along with a lots of other pre-existing stuff. Try another uninstall plus deleting the penv, python3 and .cache folders in your screenshot, create a new folder in ESP32, e.g. .platformio, and set PLATFORMIO_CORE_DIR to that path and try a reinstall.

You also don’t need to reinstall Python or VSCode, just remove the PlatformIO extension in VSCode and re-add it later.

This time I deleted the ESP32 directory completely and create a platformio directory. Nothing else in it. The VScode and Python is installed under E:\programs.…
I changed the environment settings as shown on the picture enclosed.
I uninstalled the PIO-extension, closed VS-code, and installed the PIO-extension again. Nothing goes into the E:\ESP32\platformio - folder.


The PIO-home button still does not show up. :joy:

I stop trying this. I think it is easier to uninstall and clean up my C-drive, and move some programs from C: to E:
I’m sorry to have taken your time and thanks a lot for your interest.
All the best…

I don’t understand the problems you’re having. I downloaded the official Windows 10 virtual machine from Microsoft, added a new virtual drive in it, formatted it as E:, created a platformio folder in it, set the system environment variable PLATFORMIO_CORE_DIR to E:\platformio, logged out of my user and relogged in (to make absolutely sure environment variables are applied), then opened the (preinstalled) VSCode installation, let it update to the latest version, then installed PlatformIO from the extension marketplace. (No need to install some Python version, the installer will auto-download a portable version if none detected).

After the installation and a VSCode restart, there is PlatformIO. Correctly installed to E:\platformio.

This is working flawlessly for me in a clean Win10 environment, as advertised in the documentation.

Maybe the Help → Toggle Developer Tools → Console has some logs that help you track down the problem.

Thank you so much for your efforts in helping me. I will certainly try again. I have spend some time cleaning up on my C: drive, so I will try to install at all default settings. in a few days
I will return with the result.

I have now installed platforio on another machine without any problems (small labtop - not suitable for development).
I think my problem is related to a mistake I have done. I deleted Studio Code “User” in a wrong fashion (not via the ordinary Apps but simply via the path, and now I cannot repair my mistake. Maybe you know the way?
I’m sure you can decipher the danish language :slight_smile:
image

If Windows can’t find an uninstaller program it should just remove it from the program list. Try the old GUI from the system settings panel → programs → programs and features → uninstall programs.

Thanks I’m learning… it helped, but did not solve my problem. I even deleted all and tried to install on C: - default all the way. I think I will try to reinstall Windows. I will be back - I think I need to buy a USB-stick for the reinstallation.

1 Like

Hi again. The problem has gone. I’m not sure what helped, but I made a Window10 repair and reinstalled Visual Studio Code and added the platformIO extension - and Voila !
I don’t think this was a platformIO issue. Something else put me off track - I want to thank you so very much for your help. I learned a lot - and that is never too late obviously (I am 74 years old…)
You are simply the best… :grinning_face_with_smiling_eyes: :+1:

1 Like

Playing around and testing the ENV-settings again I succeded in partially getting installed on the E:-drive. It only took me 7 days :joy:
However some of the settings must be wrong - because I would expect to be able to load an example using the “Import Project Example” from the PIO home screen. I do think this has to do with the setup on my E:-drive. The error message is long, so I only include what I think is essential here (I have removed some of the line feeds for readability):

Could not import project
PIO Core Call Error: "The current working directory C:\Users\Steen\Documents\PlatformIO\Projects\210612-110316-espidf-arduino-wifiscan will be used for the project.

The next files/directories have been created in C:[\Users\Steen\Documents\PlatformIO\Projects\210612-110316-espidf-arduino-wifiscan](file://Users//Steen//Documents//PlatformIO//Projects//210612-110316-espidf-arduino-wifiscan/)

include -

Put project header files here <—??? Am I supposed to use the directory on the C-drive? Why - when I have set the E:drive?

Put here project specific (private) libraries

Put project source files here

platformio.ini - Project Configuration File

Error: Traceback (most recent call last):

File “e:\esp\esp_idf\penv\lib\site-packages\platformio\main.py”, line 109, in main\r\n cli() # pylint: disable=no-value-for-parameter

File “e:\esp\esp_idf\penv\lib\site-packages\click\core.py”, line 829, in call

return self.main(*args, **kwargs)

File “e:\esp\esp_idf\penv\lib\site-packages\click\core.py”, line 782, in main\r\n rv = self.invoke(ctx)

etc…

The path where the PlatformIO core is installed and where the default project location folder is are two different things. The latter can be inspected in the CLI by executing pio settings get (see projects_dir) and also changed via pio settings set projects_dir <new default path here>.

It still shouldn’t happen that PlatformIO crashes that way. Sadly in Python exceptions the part where it crashes is displayed in the bottom which is not shown, so I can’t help further with only that backtrace.

:slight_smile: OK - moving forward. Trust me - I am working hard not to disturb you too much. I ignore the errors and got the project placed as I wish:
image
As I understand I have to locate the libraries and place them in the ESP-Libraries as shown.
image
However I cannot figure out where I find these?

Is this an Arduino or ESP-IDF with Arduino as a component project?

In any case since the previous step failed it might have influenced that Intellisense is not working. Please open a new topic for this, with the output of pio init --ide=vscode in a CLI, as this is not on-topic here anymore.