Pio Core Shell Completion : No such file or directory

Hello,

I recently installed pio shell completion using pio system completion install on a computer with Ubuntu. The installation was confirmed with this message :

PlatformIO CLI completion has been installed for bash shell to /home/username/.bash_completion 
Please restart a current shell session.

But now, every time I try to use tab completion, I get the following messages depending on which command I try to complete :

env: ‘pio’: No such file or directory
env: ‘platformio’: No such file or directory

I know that env is used inside ~/.bash_completion, yet I don’t understand why env doesn’t recognize pio or platformio.

Thanks a lot. Any help would be greatly appreciated

You have done Method 1 as described in the docs?

Yes, I added platformio to PATH, hence the fact that using pio or platformio works.

The message only appears when I press TAB for shell completion.

What shell and distribution are you using? In which file did you make the modification to add PlatformIO to the PATH?

My shell and distribution :

$ uname -a
Linux athena 5.11.0-37-generic #41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ echo $SHELL
/bin/bash

As for how I added PlatformIO to the path, I added the following line in a file that is sourced in .bashrc :

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