Platformio-atom-ide: Using built-in pio cli not possible (PATH modification fails)

Created on 19 Feb 2016  路  27Comments  路  Source: platformio/platformio-atom-ide

Solution

Temporary solutions:


Under certain (unknown) circumstances it's not possible to use the built-in pio command.

My system:

  • Arch Linux
  • Atom 1.5.3
  • PlatformIO 2.8.4 | IDE 1.0.0
  • NodeJS 5.6.0

problematic with both bash and zsh

default $PATH: /usr/local/sbin:/usr/local/bin:/usr/bin

$PATH is updated in "process.env.PATH":
(dev console in atom)

> process.env.PATH
<- "/home/user/.atom/packages/platformio-ide/penv/bin:/usr/local/sbin:/usr/local/bin:/usr/bin

but when clicking on e.g. serial ports toolbar button I get this:

$ pio serialports list
command not found: pio
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin
$ node -e "console.log(process.env.PATH)"
/usr/local/sbin:/usr/local/bin:/usr/bin
$ export PATH=/home/user/.atom/packages/platformio-ide/penv/bin:$PATH
$ which pio
/home/user/.atom/packages/platformio-ide/penv/bin/pio
bug

Most helpful comment

Guys, I forgot about temporary solution. Please click Menu: PlatformIO > Settings > PlatformIO IDE Terminal > Auto Run Command and specify it to export PATH=~/.atom/packages/platformio-ide/penv/bin:$PATH

All 27 comments

This may happen if you open a terminal too quickly and IDE is not initialized yet. Please wait few seconds after Atom start and see if pio is still not found.

@orgkhnargh I tested this issue on @jbbr PC yesterday. This issue is linked with our Terminal. I'll explain you later.

Same here. As described by @jbbr adding the location to the PATH will fix it. For now this is good enough for me.

Guys, I forgot about temporary solution. Please click Menu: PlatformIO > Settings > PlatformIO IDE Terminal > Auto Run Command and specify it to export PATH=~/.atom/packages/platformio-ide/penv/bin:$PATH

Just got bitten by this too. @ivankravets workaround works but it's one more thing I need to document for my coworkers for getting set up with platformio if we choose to use it.

@jeffcharles

it's one more thing I need to document for my coworkers for getting set up with platformio if we choose to use it.

That is a very specific issue. We don't know how to reproduce it. We have more than 14k downloads of our IDEs and only a few users reported this problem.

We will try to reproduce it and understand how to fix it. I hope that your team's members will not have this problem :blush:

P.S: Thank you that use PlatformIO and recommend for the team! :+1:

I'm experiencing the same issue. Reinstalling platformio-ide does not help. Using Arch Linux like @jbbr - is there a pattern here? Do we all use Arch? (My Fedora box is fine.)

I have the same issue, and the workaround fixes it. Not on Arch Linux; I've installed atom package platformio-ide 1.1.2, which installed platformio-ide-terminal 2.0.9 into Atom 1.7.2 running on Mac OS X 10.11.3. process.env.PATH (in dev console) does include the path to the bin directory, but when a platformio terminal opens, it isn't part of the path.

Hi. Newbie here. I'm getting a similar error on windows 7.
pio : The term 'pio' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.

I saw the note above about modifying the path but not sure how to do that in windows. Any thoughts are appreciated.

@kozoke could you share an output of echo %PATH% from PlatformIO Terminal?

I just figured it out. In Windows, if you go into the environmental variables, search for Path. I added the following to the variable: C:\Users.atom\packagesplatformio-ide\penv\Scripts

This solved the problem. Thanks @ivankravets for offering to help!

@kozoke thanks, this fixed the same problem for me on Windows 10. I'd been getting the message "Cannot load PSReadline module." at the top of the console and spent ages seeing if that was the problem, but updating the environmental variables as you suggested fixed it for me.

Adding it to the system path sure seems to "fix" it, but it's hardly a solution as it clutters the PATH and breaks if there is a path to another command named "pio" in the PATH.

http://docs.platformio.org/en/latest/faq.html#platformio-is-not-recognized-as-an-internal-or-external-command

image

@AndreKR do you use PIO IDE Terminal? See special icon on Toolbar (bottom)

This terminal opened automatically when I clicked the "Platform IO: Serial Monitor" in the Platform IO toolbar.

When I click "Platform IO: New Terminal" it only shows the pio --help part but that also fails because it can't find pio.

If I run echo %PATH% in that terminal, nothing from the Platform IO installation is there.

@AndreKR
This repository is intended for PIO IDE for Atom where you posted a screenshot from VSCode.

Please open new issue here https://github.com/platformio/platformio-vscode-ide/issues

Oops, sorry.

I'll do that, but you got me curious and I'll have a quick look if updateOSEnviron() isn't being called or if it doesn't modify process.env.PATH correctly. This Electron extension stuff doesn't seem too complicated.

Ok, done, but I don't understand what I am seeing.

I ve tried but does not work in 3 states:
1) only .bashrc
2) both .bashrc and atom package settings of pio
3) none
In picture below you can see that it is available under my shell.
resim

On Ubuntu I copy and pasted:
export PATH=~/.atom/packages/platformio-ide/penv/bin:$PATH
to the auto-run command in settings and it doesn't appear to have changed anything.

I'm trying to run a serial monitor with an Arduino connected and I keep getting:
pio: command not found

It was working RIGHT before I installed and set up Nodejs for my machine.

I had the same problem and for me the recommendation from @ivankravets didn't work. I had to change the export string to a different folder:
export PATH=~/.platformio/penv/bin:$PATH

This appears to be a major problem for a lot of people (me included) and it should be fixed, it shouldn't be a user-configuration issue. Moreover, the advice to

export PATH=~/.atom/packages/platformio-ide/penv/bin:$PATH

is linked from all sorts of other pages here on github with nice glowing blue lines round it (as if it must be right) but this is WRONG. Moreover, there are a lot of other red herrings here in this thread, not nice for newbies. It took me a long time to scroll down to read ToPitz's post (thank you!) and get the correct path. Please fix things so that a basic user can follow the web links and get the correct

export PATH=~/.platformio/penv/bin:$PATH

more quickly!

I'm back here again. I had to return back to remind myself what the workaround was on this issue, because after an automatic update of platformio the settings that fixed the problem were wiped by the update.

Guys: this all looks very amateurish on your part and really needs to be sorted before any of us might want to recommend this software to others. The problem was there since Februrary 2016 and not only hasn't been fixed but recent updates actually wipe out the workaround...

@jbbr could you update the top of this ticket to point to the right comment, as @ToPitz and @rwkaye says the path is wrong. Took me a while too scroll to bottom too to work that out, but working is:

Menu: PlatformIO > Settings > PlatformIO IDE Terminal > Auto Run Command and specify it to export PATH=~/.platformio/penv/bin:$PATH

I have the same problem, and no matter where I put the right path it will still do the same, I had to manually write the path on platformio terminal to run the command properly and compile which in my case is:
C:\Users\ZerusPocus.platformio\penv\Scripts\platformio run -e STM32F103RC_btt_512K_USB

Was this page helpful?
5 / 5 - 1 ratings

Related issues

sstaub picture sstaub  路  7Comments

schmurfy picture schmurfy  路  7Comments

TheQuantumPhysicist picture TheQuantumPhysicist  路  7Comments

ricavalcanti picture ricavalcanti  路  6Comments

micr0me picture micr0me  路  6Comments