Specify Path to PlatformIO in Visual Studio Code

  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.

Will do - and thanks again.
AND I have had a AHA-experience - I can now switch PIO ON and OFF just by disabling PIO in a project. This may have disturbed me earlier.

1 Like

I have come a long way forward now. I’m not sure if the windows path is not disturbing me. I am trying a book example from Randomnerds: “2_5_Mutiple_Outputs_Websocket_server” and it works when the code is downloaded without any change. I can display and change a button via my mobile phone and via a browser window - it changes on the screens and one of the LED’s on the board happens to be on the correct GPIO and changes. It works perfectly.
However I cannot edit the index.html - nothing changes. I cannot edit the design. I think the path is cheating me.
In the PlatformIO core CLI I have the following path: E:\ESP\ESP32_Projects\2_5_Multiple_Outputs_WebSocket>
and my index.html is in this path below:
image
When I edit the index.html the changes are not uploaded to the ESP32 board.
I need to know where/what index.html file I have to work on ??

The files are only uploaded if you execute the “Upload File system image” task. A normal “upload” will not do that. This is documented in Espressif 32 — PlatformIO latest documentation.

But I’m not sure how this relates to this topic?

The solution
My god … I am a total idiot… I forgot to set the board in programming mode.
I did not press “Boot” and “EN” !!!

I set the environment in Win10 and reinstall pio, but it didn’t work.