Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Emoncms on Ubuntu 20.04 with scripts

Tags: #<Tag:0x00007f1be31500a8> #<Tag:0x00007f1be315ff80>

Hi, I have installed Emoncms using the scripts on Ubuntu.

The backup export function doesn’t work when I press the button. The log window also don’t display any information.

Any advice?

I hit this problem before. I think it might be permissions.

Did you add a user, then install as that user?

The installation script did ask for a Pi user and then it stopped, I went back and added my user in the config file then rerun the script

Ah, but did you install when logged in as that user?

Is the service service-runner running?

I had to install the service-runner manually, its running now.

That isn’t good news. Why and how?

I followed these steps to get it working.

That isn’t good as those are old instructions and the emonscripts do things differently.

I think your issue is the same as here that I’m not sure has been fixed. All you needed to do was edit the drop-in.

My suggestion is to start again, trying to fix what you have done will probably take longer, update will not like it etc.

Happy to help as we need to fix the scripts.

Thanks, its very possibly the issue, I will restart my installation. Can you please direct me to the file location to edit the drop-in when I reinstall?

Yes. I suggest you have a read through that issue on GitHub. I think we decided that there were also issues around permissions of the Modules folder.

TBH, the simplest way is to create a user ‘pi’ and use that!

Done a fresh Ubuntu server installation, only created “pi” username.
Updated the config.ini file to change the non-pi environment.
Ran the install ./main.sh script, but the service-running did not start

I noticed that the /usr/bin/python directory does not exist.

[email protected]:/opt/openenergymonitor/EmonScripts/install$ journalctl -f -u service-runner
-- Logs begin at Tue 2020-08-11 15:23:57 UTC. --
Aug 11 16:39:45 emoncms systemd[2647]: service-runner.service: Failed at step EXEC spawning /usr/bin/python: No such file or directory
Aug 11 16:39:45 emoncms systemd[1]: service-runner.service: Main process exited, code=exited, status=203/EXEC
Aug 11 16:39:45 emoncms systemd[1]: service-runner.service: Failed with result 'exit-code'.
Aug 11 16:40:16 emoncms systemd[1]: service-runner.service: Scheduled restart job, restart counter is at 101.
Aug 11 16:40:16 emoncms systemd[1]: Stopped Emoncms service-runner Input Script.
Aug 11 16:40:16 emoncms systemd[1]: Started Emoncms service-runner Input Script.
Aug 11 16:40:16 emoncms systemd[2661]: service-runner.service: Failed to execute command: No such file or directory
Aug 11 16:40:16 emoncms systemd[2661]: service-runner.service: Failed at step EXEC spawning /usr/bin/python: No such file or directory
Aug 11 16:40:16 emoncms systemd[1]: service-runner.service: Main process exited, code=exited, status=203/EXEC
Aug 11 16:40:16 emoncms systemd[1]: service-runner.service: Failed with result 'exit-code'.
    indent preformatted text by 4 spaces

For future reference, when posting code or bash output, put in 3 ‘backticks’ (found at the top left of the keyboard normally) on a line on their own, then the code, then 3 more backticks on a line following the code.

    ```
    code
    ```

If it is something like php you can add a language identifier that after the first 3 backticks so ```php

What is the result of

which python

I got no results from the command, but it would seem like Python 3.8.2 is installed but it does not have a reference to “python” and had to use “python3”

[email protected]:/$ which python
[email protected]:/$
[email protected]:/$ python

Command 'python' not found, did you mean:

  command 'python3' from deb python3
  command 'python' from deb python-is-python3

[email protected]:/$ python3
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

service-runner needs Python as opposed to Python3 (still - I’ve raised an issue). I think this must either be installed by default on the Pi, or it just so happened that service runner was picking it up on the back of it being installed for another purpose (when other modules used python).

What also might have happened is Ubuntu have changed the install as python2.x is EOL.

To check what is installed can you please run

apt list --installed pytho*

See output

[email protected]:~$ apt list --installed pytho*
Listing... Done
python-apt-common/focal-updates,now 2.0.0ubuntu0.20.04.1 all [installed,automatic]
python3-apport/focal-updates,focal-security,now 2.20.11-0ubuntu27.6 all [installed,automatic]
python3-apt/focal-updates,now 2.0.0ubuntu0.20.04.1 amd64 [installed,automatic]
python3-attr/focal,now 19.3.0-2 all [installed,automatic]
python3-automat/focal,now 0.8.0-1ubuntu1 all [installed,automatic]
python3-blinker/focal,now 1.4+dfsg1-0.3ubuntu1 all [installed,automatic]
python3-certifi/focal,now 2019.11.28-1 all [installed,automatic]
python3-cffi-backend/focal,now 1.14.0-1build1 amd64 [installed,automatic]
python3-chardet/focal,now 3.0.4-4build1 all [installed,automatic]
python3-click/focal,now 7.0-3 all [installed,automatic]
python3-colorama/focal,now 0.4.3-1build1 all [installed,automatic]
python3-commandnotfound/focal,now 20.04.2 all [installed,automatic]
python3-configobj/focal,now 5.0.6-4 all [installed,automatic]
python3-constantly/focal,now 15.1.0-1build1 all [installed,automatic]
python3-cryptography/focal,now 2.8-3 amd64 [installed,automatic]
python3-dbus/focal,now 1.2.16-1build1 amd64 [installed,automatic]
python3-debconf/focal,now 1.5.73 all [installed,automatic]
python3-debian/focal,now 0.1.36ubuntu1 all [installed,automatic]
python3-distro-info/focal,now 0.23ubuntu1 all [installed,automatic]
python3-distro/focal,now 1.4.0-1 all [installed,automatic]
python3-distupgrade/focal-updates,now 1:20.04.23 all [installed,automatic]
python3-distutils/focal,now 3.8.2-1ubuntu1 all [installed,automatic]
python3-entrypoints/focal,now 0.3-2ubuntu1 all [installed,automatic]
python3-gdbm/focal,now 3.8.2-1ubuntu1 amd64 [installed,automatic]
python3-gi/focal,now 3.36.0-1 amd64 [installed,automatic]
python3-hamcrest/focal,now 1.9.0-3 all [installed,automatic]
python3-httplib2/focal,now 0.14.0-1ubuntu1 all [installed,automatic]
python3-hyperlink/focal,now 19.0.0-1 all [installed,automatic]
python3-idna/focal,now 2.8-1 all [installed,automatic]
python3-importlib-metadata/focal,now 1.5.0-1 all [installed,automatic]
python3-incremental/focal,now 16.10.1-3.2 all [installed,automatic]
python3-jinja2/focal,now 2.10.1-2 all [installed,automatic]
python3-json-pointer/focal,now 2.0-0ubuntu1 all [installed,automatic]
python3-jsonpatch/focal,now 1.23-3 all [installed,automatic]
python3-jsonschema/focal,now 3.2.0-0ubuntu2 all [installed,automatic]
python3-jwt/focal,now 1.7.1-2ubuntu2 all [installed,automatic]
python3-keyring/focal,now 18.0.1-2ubuntu1 all [installed,automatic]
python3-launchpadlib/focal,now 1.10.13-1 all [installed,automatic]
python3-lazr.restfulclient/focal,now 0.14.2-2build1 all [installed,automatic]
python3-lazr.uri/focal,now 1.0.3-4build1 all [installed,automatic]
python3-lib2to3/focal,now 3.8.2-1ubuntu1 all [installed,automatic]
python3-markupsafe/focal,now 1.1.0-1build2 amd64 [installed,automatic]
python3-minimal/focal,now 3.8.2-0ubuntu2 amd64 [installed,automatic]
python3-more-itertools/focal,now 4.2.0-1build1 all [installed,automatic]
python3-nacl/focal,now 1.3.0-5 amd64 [installed]
python3-netifaces/focal,now 0.10.4-1ubuntu4 amd64 [installed,automatic]
python3-newt/focal,now 0.52.21-4ubuntu2 amd64 [installed,automatic]
python3-oauthlib/focal,now 3.1.0-1ubuntu2 all [installed,automatic]
python3-openssl/focal,now 19.0.0-1build1 all [installed,automatic]
python3-pkg-resources/focal,now 45.2.0-1 all [installed,automatic]
python3-problem-report/focal-updates,focal-security,now 2.20.11-0ubuntu27.6 all [installed,automatic]
python3-pyasn1-modules/focal,now 0.2.1-0.2build1 all [installed,automatic]
python3-pyasn1/focal,now 0.4.2-3build1 all [installed,automatic]
python3-pymacaroons/focal,now 0.13.0-3 all [installed]
python3-pyrsistent/focal,now 0.15.5-1build1 amd64 [installed,automatic]
python3-requests-unixsocket/focal,now 0.2.0-2 all [installed,automatic]
python3-requests/focal,now 2.22.0-2ubuntu1 all [installed,automatic]
python3-secretstorage/focal,now 2.3.1-2ubuntu1 all [installed,automatic]
python3-serial/focal,now 3.4-5.1 all [installed,automatic]
python3-service-identity/focal,now 18.1.0-5build1 all [installed,automatic]
python3-setuptools/focal,now 45.2.0-1 all [installed,automatic]
python3-simplejson/focal,now 3.16.0-2ubuntu2 amd64 [installed,automatic]
python3-six/focal,now 1.14.0-2 all [installed,automatic]
python3-software-properties/focal-updates,now 0.98.9.1 all [installed,automatic]
python3-systemd/focal,now 234-3build2 amd64 [installed,automatic]
python3-twisted-bin/focal,now 18.9.0-11 amd64 [installed,automatic]
python3-twisted/focal,now 18.9.0-11 all [installed,automatic]
python3-update-manager/focal-updates,now 1:20.04.10.1 all [installed,automatic]
python3-urllib3/focal,now 1.25.8-2 all [installed,automatic]
python3-wadllib/focal,now 1.3.3-3build1 all [installed,automatic]
python3-yaml/focal,now 5.3.1-1 amd64 [installed,automatic]
python3-zipp/focal,now 1.0.0-1 all [installed,automatic]
python3-zope.interface/focal,now 4.7.1-1 amd64 [installed,automatic]
python3.8-minimal/focal-updates,focal-security,now 3.8.2-1ubuntu1.2 amd64 [installed,automatic]
python3.8/focal-updates,focal-security,now 3.8.2-1ubuntu1.2 amd64 [installed,automatic]
python3/focal,now 3.8.2-0ubuntu2 amd64 [installed,automatic]
[email protected]:~$

Yes so only python3.

Try

sudo apt-get install -y python-pip python-dev

See output

[email protected]:~$ sudo apt-get install -y python-pip python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python-dev-is-python2' instead of 'python-dev'
E: Unable to locate package python-pip

Looks like Ubuntu have dropped python from the repos.

[edit]

what does simply running python give you before you do below?

Quick Google;

Try

sudo apt install python2

Check where is is with which python

python2 installed, but see output.
No output from which python also no reference to python

[email protected]:~$ which python
[email protected]:~$ python

Command 'python' not found, did you mean:

  command 'python3' from deb python3
  command 'python' from deb python-is-python3

[email protected]:~$ python2
Python 2.7.18rc1 (default, Apr  7 2020, 12:05:55)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>


What does which python2 give you?

What Ubuntu version are you running (bit late to ask, but hey ho)?