PIO remote step by step for dummies?


#1

Hi!

I’m trying run a remote agent on RPI 3 following the instructions bellow but it seems not enough.

https://docs.platformio.org/en/latest/installation.html

https://docs.platformio.org/en/latest/userguide/remote/cmd_agent.html?

On PIO core “full” guide what should I make to activate virtual environment?

Should I make $ python activate_this.py?

Then how to install PIO core into virtual environment? The command pip install -U platformio will say it’s installed already

The instruction seems incomplete.

What I did:

pi@Geeetech:~ $ python --version
Python 2.7.13
pi@Geeetech:~ $ sudo pip install -U platformio
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting platformio
  Using cached https://files.pythonhosted.org/packages/b4/fe/6cf776ae6feb69c6afd3362700174e9e03a020113a3f0b1684deafefec95/platformio-3.6.0-py27-none-any.whl
Requirement already satisfied, skipping upgrade: semantic-version<3,>=2.5.0 in /usr/local/lib/python2.7/dist-packages (from platformio) (2.6.0)
Requirement already satisfied, skipping upgrade: requests<3,>=2.4.0 in /usr/local/lib/python2.7/dist-packages (from platformio) (2.12.1)
Requirement already satisfied, skipping upgrade: pyserial!=3.3,<4,>=3 in /usr/local/lib/python2.7/dist-packages (from platformio) (3.2.1)
Requirement already satisfied, skipping upgrade: click<6,>=5 in /usr/local/lib/python2.7/dist-packages (from platformio) (5.1)
Requirement already satisfied, skipping upgrade: colorama in /usr/local/lib/python2.7/dist-packages (from platformio) (0.3.9)
Requirement already satisfied, skipping upgrade: bottle<0.13 in /usr/local/lib/python2.7/dist-packages (from platformio) (0.12.13)
Installing collected packages: platformio
Successfully installed platformio-3.6.0
pi@Geeetech:~ $ python -c "import os; print os.path.join(os.getenv('PLATFORMIO_HOME_DIR', os.path.join(os.path.expanduser('~'), '.platformio')), 'penv')"
/home/pi/.platformio/penv
pi@Geeetech:~ $ cd /home/pi/.platformio/penv
-bash: cd: /home/pi/.platformio/penv: No such file or directory
pi@Geeetech:~ $ sudo pip install virtualenv
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: virtualenv in /usr/local/lib/python2.7/dist-packages (16.0.0)
pi@Geeetech:~ $ sudo virtualenv /home/pi/.platformio/penv
New python executable in /home/pi/.platformio/penv/bin/python
Installing setuptools, pip, wheel...done.
pi@Geeetech:~ $ cd /home/pi/.platformio/penv/bin
pi@Geeetech:~/.platformio/penv/bin $ ls
activate  activate.csh  activate.fish  activate_this.py  easy_install  easy_install-2.7  pip  pip2  pip2.7  python  python2  python2.7  python-config  wheel
pi@Geeetech:~/.platformio/penv/bin $ python activate_this.py

After this steps the commands to remote agent doesn’t give any returns:

pi@Geeetech:~ $ sudo platformio remote agent start
pi@Geeetech:~ $ sudo platformio remote agent list

Also the command to login in my account doesn’t returns anything:

pi@Geeetech:~/.platformio/penv/bin $ pio account login -u MyEmail -p Mypassword
pi@Geeetech:~/.platformio/penv/bin $ pio account show

Login with token doesn’t give any result also:

pi@Geeetech:~/.platformio/penv/bin $ pio account token -p MyToken
pi@Geeetech:~/.platformio/penv/bin $ pio account show

Additional info:

pi@Geeetech:~ $ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
pi@Geeetech:~ $ echo $PYTHONPATH

pi@Geeetech:~ $ pip --version
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

What I did wrong? What should be the right step by step?

Thanks in advance!

Best regards.


Problem with Platformio on Raspberry Pi 1 Model B
#2

What is your Linux distributive? Could you try to remove ~/.platformio folder and run $ pio account login command again?

You do everything correctly, there is an issue that PIO Plus Core does not work on your RPi.


#3

Hi!

Thanks for your answer.

I’ll try it later and let you know.

I’m using Astrobox it’s based on Raspbian if I’m not wrong.

Can you clarify the points above in docs please? It will help others users.

Best regards.


#4

See https://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/

Please provide valid distro name. Thanks!


#5

Hi!

pi@Geeetech:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.4 (stretch)
Release:        9.4
Codename:       stretch

Best regards.


#6

After reinstall everything including OS the result is the same:

pi@Geeetech:~ $ python /home/pi/.platformio/penv/bin/activate_this.py
pi@Geeetech:~ $ sudo platformio remote agent start
*********************************************************************************************************************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for IoT development > https://platformio.org/platformio-ide
- support us with PlatformIO Plus > https://pioplus.com
*********************************************************************************************************************************************************************************

CorePackageManager: Installing tool-pioplus @ ^1.4.5
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
tool-pioplus @ 1.4.8 has been successfully installed!
CorePackageManager: Installing contrib-pysite @ >=0.3.2,<2
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
contrib-pysite @ 0.3.2 has been successfully installed!
pi@Geeetech:~ $ sudo platformio remote agent list
pi@Geeetech:~ $ sudo rm -r /home/pi/.platformio
pi@Geeetech:~ $ pio account login -u MyEmail -p MyPassword
*********************************************************************************************************************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for IoT development > https://platformio.org/platformio-ide
- support us with PlatformIO Plus > https://pioplus.com
*********************************************************************************************************************************************************************************

CorePackageManager: Installing tool-pioplus @ ^1.4.5
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
tool-pioplus @ 1.4.8 has been successfully installed!
CorePackageManager: Installing contrib-pysite @ >=0.3.2,<2
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
contrib-pysite @ 0.3.2 has been successfully installed!
pi@Geeetech:~ $ sudo pio account show
pi@Geeetech:~ $

#7

Thanks! I’ll install Raspbian on my RPi and test it.


#8

So, it works on my RPi.

(piodev)pi@raspberrypi ~ $ cat /proc/version
Linux version 4.1.19-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #858 SMP Tue Mar 15 15:56:00 GMT 2016
(piodev)pi@raspberrypi ~ $ pio remote agent start
PIO Plus (https://pioplus.com) v1.4.8
2018-09-17 17:55:15 [info] Name: raspberrypi
2018-09-17 17:55:15 [info] Connecting to PIO Remote Cloud
2018-09-17 17:55:15 [info] Successfully connected
2018-09-17 17:55:15 [info] Authenticating
2018-09-17 17:55:15 [info] Successfully authorized

Could you provide an output from this command?

$ ~/.platformio/packages/tool-pioplus/pioplus

#9

Hi!

Thanks for your time!

I don’t know if does matter but my Linux version is ahead.

  pi@Geeetech:~/.platformio/packages/tool-pioplus $ cat /proc/version
    Linux version 4.14.69+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1141 Mon Sep 10 15:13:50 BST 2018

What does this command? Is to open the directory?

The result for this command is:

pi@Geeetech:~ $ /.platformio/packages/tool-pioplus/pioplus
-bash: /.platformio/packages/tool-pioplus/pioplus: No such file or directory

Using ls I can find pioplus file.

pi@Geeetech:~ $ cd .platformio/packages/tool-pioplus
pi@Geeetech:~/.platformio/packages/tool-pioplus $ ls
package.json  pioplus

Best regards.


#10

I see. I’ve just installed the latest Raspbian and had the same issue. They removed Python libraries from default distribution. Please run sudo apt-get install python-dev. Does it work now?
I’ll think how to resolve this issue better.


#11

This package is installed already.

pi@Geeetech:~ $ sudo apt-get install python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-dev is already the newest version (2.7.13-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

#12

Could you try?

$ ldd ~/.platformio/packages/tool-pioplus

Also, try this:

  1. Please remove GLOBAL platformio using pip uninstall platformio command.
  2. Install it into virtual environment and run $ platformio from env.

#13

No way!

pi@Geeetech:~ $ ldd ~/.platformio/packages/tool-pioplus
ldd: /home/pi/.platformio/packages/tool-pioplus: not regular file

pi@Geeetech:~ $ sudo pip uninstall platformio
Uninstalling platformio-3.6.0:
Would remove:
/usr/local/bin/pio
/usr/local/bin/piodebuggdb
/usr/local/bin/platformio
/usr/local/lib/python2.7/dist-packages/platformio-3.6.0.dist-info/*
/usr/local/lib/python2.7/dist-packages/platformio/*
Proceed (y/n)? y
Successfully uninstalled platformio-3.6.0

pi@Geeetech:~ $ python -c "import os; print os.path.join(os.getenv('PLATFORMIO_HOME_DIR', os.path.join(os.path.expanduser('~'), '.platformio')), 'penv')"
/home/pi/.platformio/penv

pi@Geeetech:~ $ cd /home/pi/.platformio/penv
-bash: cd: /home/pi/.platformio/penv: No such file or directory

pi@Geeetech:~ $ sudo virtualenv /home/pi/.platformio/penv
New python executable in /home/pi/.platformio/penv/bin/python
Installing setuptools, pip, wheel...done.

pi@Geeetech:~ $ cd /home/pi/.platformio/penv

pi@Geeetech:~/.platformio/penv $ python /home/pi/.platformio/penv/bin/activate_this.py

pi@Geeetech:~/.platformio/penv $ sudo pip install -U platformio
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting platformio
  Using cached https://files.pythonhosted.org/packages/b4/fe/6cf776ae6feb69c6afd3362700174e9e03a020113a3f0b1684deafefec95/platformio-3.6.0-py27-none-any.whl
Requirement already satisfied, skipping upgrade: semantic-version<3,>=2.5.0 in /usr/local/lib/python2.7/dist-packages (from platformio) (2.6.0)
Requirement already satisfied, skipping upgrade: requests<3,>=2.4.0 in /usr/local/lib/python2.7/dist-packages (from platformio) (2.12.1)
Requirement already satisfied, skipping upgrade: pyserial!=3.3,<4,>=3 in /usr/local/lib/python2.7/dist-packages (from platformio) (3.2.1)
Requirement already satisfied, skipping upgrade: click<6,>=5 in /usr/local/lib/python2.7/dist-packages (from platformio) (5.1)
Requirement already satisfied, skipping upgrade: colorama in /usr/local/lib/python2.7/dist-packages (from platformio) (0.3.9)
Requirement already satisfied, skipping upgrade: bottle<0.13 in /usr/local/lib/python2.7/dist-packages (from platformio) (0.12.13)
Installing collected packages: platformio
Successfully installed platformio-3.6.0

pi@Geeetech:~/.platformio/penv $ sudo pio account token -p MyToken
pi@Geeetech:~/.platformio/penv $ sudo pio account show
pi@Geeetech:~/.platformio/penv $ sudo pio remote agent start
pi@Geeetech:~/.platformio/penv $ sudo pio remote agent list

#14

Why do you use SUDO? Please again remove PlatformIO from a system and follow steps mentioned here http://docs.platformio.org/en/latest/installation.html#virtual-environment

You don’t install PlatformIO Core into the virtual environment because you use a strange command python /home/pi/.platformio/penv/bin/activate_this.py. Where did you find it? It should be

source /home/pi/.platformio/penv/bin/activate

Now

(penv) > pip install platformio
(penv) > pio account login

#15

You don’t install PlatformIO Core into the virtual environment because you use a strange command python /home/pi/.platformio/penv/bin/activate_this.py . Where did you find it? It should be

Please go back to my first comment here.


#16

Why do you use SUDO?

Without SUDO the result is:

pi@Geeetech:~ $ /home/pi/.platformio/penv/bin/activate
-bash: /home/pi/.platformio/penv/bin/activate: Permission denied

With this source in command line the result is:

pi@Geeetech:~ $ source /home/pi/.platformio/penv/bin/activate
(penv) pi@Geeetech:~

But this source is not contained in instruction quoted.


#17

Now seems I’m working in VE because I can see (penv) before each command line.


#18

Anyway the result is the same.

( penv) pi@Geeetech:~ $ pio account token -p Mytoken
*********************************************************************************************************************************************************************************
If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news > https://twitter.com/PlatformIO_Org
- star it on GitHub > https://github.com/platformio/platformio
- try PlatformIO IDE for IoT development > https://platformio.org/platformio-ide
- support us with PlatformIO Plus > https://pioplus.com
*********************************************************************************************************************************************************************************

CorePackageManager: Installing tool-pioplus @ ^1.4.5
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
tool-pioplus @ 1.4.8 has been successfully installed!
CorePackageManager: Installing contrib-pysite @ >=0.3.2,<2
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
contrib-pysite @ 0.3.2 has been successfully installed!
(penv) pi@Geeetech:~ $ pio account show
(penv) pi@Geeetech:~ $ pio agent start
Usage: pio [OPTIONS] COMMAND [ARGS]...

(penv) pi@Geeetech:~ $ pio remote agent start
(penv) pi@Geeetech:~ $ pio remote agent list

(penv) pi@Geeetech:~ $ pio account login -u MyEmail -p MyPass
(penv) pi@Geeetech:~ $ pio account show
(penv) pi@Geeetech:~ $

#19

Do you have right permissions for ~/.platformio folder? It seems that you mixed ROOT/PI.

I recommend fully remove ~/.platformio folder and repeat procedure WITHOUT sudo. I did that yesterday without sudo and it works.

Thanks!


#20

In last attempt I did virtualenv /home/pi/.platformio/penv without sudo