Motioneye for Python3?

2,323 views
Skip to first unread message

Rolf Pedersen

unread,
May 9, 2021, 2:16:38 PM5/9/21
to moti...@googlegroups.com
Howdy,

Mageia7 has python2.7 and I installed motioneye on it.  Another machine
runs Mageia8, which, along with current versions of most distros, has
dropped python2, as so many other distros.  I followed the heretofore
successful recipes over at
https://github.com/ccrisan/motioneye/wiki/Install-On-Other-Distributions
etc.  However, starting motioneye (on MGA8) fails with, in part:
  May 09 10:34:40 z170i meyectl[1061472]: ModuleNotFoundError: No
module named 'settings'
and I'm pretty sure that's due to a lack of python2 on this machine. 
Attempting to install select python2 packages from Mageia7 repositories
leads me quickly to the realization that system breakage lies that way.

Over at the github Issues area, I see StarbaseSSD, aka Kevin Shumaker,
iianm, has weighed in with comment on some fairly stale issue threads,
so I'm relatively hopeful of getting a reality check on what is
happening vis-a-vis python3, maybe even advice on this particular
project of mine.

Thanks!
Rolf

StarbaseSSD

unread,
May 9, 2021, 3:42:30 PM5/9/21
to motioneye
It's coming, slowly, but it's coming. If you can run Docker, I'd suggest going that way on a non-Debian/Ubuntu based system.
You may need to take into consideration, not just Python 2.7, but pip2, instructions for installing can be found in the Ubuntu 20.04 or Newer set of instructions. Then you'll have to default to python2/pip2, or make some mods in the systemctl startup scripts. (they currently point to /usr/bin/python, IIRC and would need to point to python2)

Rolf Pedersen

unread,
May 10, 2021, 8:16:40 PM5/10/21
to moti...@googlegroups.com

Ok, I gave docker a go but it's just too foreign for me, not amenable to my "frantic hammering" IT methods.

Ultimately, I followed the github issues clues to ualex73's fork of motioneye for python3:  https://github.com/ualex73/motioneye/tree/python3

Although I ran python setup.py build and sudo python setup.py install, I was still getting an error from sudo systemctl status motioneye about meyectl.py in /usr/local/lib/python3.8/site-packages/motioneye/  I copied the newly built meyectl.py over there but that gave an error from a different file in status.  Since all the files in the build directory had the same name but differed in size/time from those in the system directory, I copied everything over:  sudo cp -r ./* /usr/local/lib/python3.8/site-packages/motioneye/

Next, CRITICAL: please install tornado version 4.5.3 or earlier (required by python3) and a similar process was followed with sources from https://github.com/tornadoweb/tornado/tree/branch4.5
Possibly, the files went to the /usr/local/lib64 python area but I didn't slow down to look, see above.
Along the way, I also followed your instructions over here https://github.com/ccrisan/motioneye/issues/2117#issuecomment-830866604 to get pip2 installed but I ran it against ccrisan's sources, which didn't work, of course.

Finally, some details forgotten, motioneye has started on my 64-bit MGA8 Z170I PRO GAMING.  I exported the settings from an installation on MGA7 on a 10-year old hp gt7725 thin client and imported them into the Skylake machine.  So far, two 5V Amcrest wifi cameras and three Amcrest POE cameras are displaying fine with little lag.  I've had one of the Amcrest 5V cameras running reliably for over a year remotely with a Netgear Unite 770S 4G LTE mifi on Mint Mobile, pass-through power bank backup, motioneyeos on Pi3b booting usb-ssd.  When I started moving on from pi cameras to multiple Amcrest around the house is when I figured I needed a more powerful machine to avoid the lags.  The thin client looks like just about enough for the current lash-up, initial lags seem to resolve over time.  It's all a mystery to me.

One thing I always have to do with a fresh install of motioneye is to change the configuration files for motion and motioneye to disable the localhost setting, else I can't see the cameras on the webpage.  I dug that detail out from ccrisan's howtos somewhere in the beginning but I don't see any mention of it, otherwise, for some reason.

[rolf@HP-Kodi ~]$ cd /etc/
[rolf@HP-Kodi etc]$ grep localhost motion/motion.conf
# Restrict webcontrol connections to the localhost.
webcontrol_localhost off
# Restrict stream connections to the localhost.
stream_localhost off
[rolf@HP-Kodi etc]$ grep localhost motioneye/motioneye.conf
# (0.0.0.0 for all interfaces, 127.0.0.1 for localhost)
# localhost or on all interfaces
motion_control_localhost false
[rolf@HP-Kodi etc]$

These values are always 'on' or 'true' on a new install for me and one of the first things I do is to flip them to get going.

Thanks,
Rolf

--
You received this message because you are subscribed to the Google Groups "motioneye" group.
To unsubscribe from this group and stop receiving emails from it, send an email to motioneye+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/motioneye/61ef08e6-60d8-4428-903c-9b0938d4b1e4n%40googlegroups.com.

Rolf Pedersen

unread,
May 11, 2021, 12:54:52 PM5/11/21
to moti...@googlegroups.com

The celebration was short-lived.  After a reboot, the webpage comes up with spinning wait emblems that don't resolve.
A stack trace from systemctl status included:  ERROR: failed to list mounted disks: 'dict_values' object has no attribute...
Oh, well.

Kevin Shumaker

unread,
May 11, 2021, 12:56:29 PM5/11/21
to Rolf Pedersen, motioneye
It is a work in progress...



--
Thanks

Kevin Shumaker


N38° 19' 56.52"
W85° 45' 8.56"

Semper Gumby
“Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
Ethics are what we do when no one else is looking.
Quis custodiet ipsos custodes?
“There is no end to the good you can do if you don’t care who gets the credit.” - C Powell
You know we're sitting on four million pounds of fuel, one nuclear weapon and a thing that has 270,000 moving parts built by the lowest bidder. Makes you feel good, doesn't it?

Kevin Shumaker

unread,
May 11, 2021, 12:57:25 PM5/11/21
to Rolf Pedersen, motioneye
If interested in Docker, let me know directly...

Rolf Pedersen

unread,
Aug 27, 2021, 1:22:58 PM8/27/21
to moti...@googlegroups.com

Howdy,

This particular personal motioneye saga, guided by Kevin Shumaker's tutelage, has had a significant development, IMO, so I'll add something of a description to this most complete record of it I can find in this group, for the record and FWIW.  Some low-hanging bullet points salvaged from increasingly porous memory:

  • I've been playing with pi, cameras, and motioneye for a couple of years, starting with Pi ZeroW and Pi camera.  This was motivated by an attempt to provide surveillance with motion-activated record of intruders for a senior citizen friend who believed she was being robbed by the housing maintenance man.  That project evolved to Pi 3B+ booting from 120G usb-connected SSD, Amcrest ProHD 1080P WiFi Camera 2MP (1920TVL), RAVPower Portable Charger 22000mAh power bank with pass-through (to maintain surveillance during short power outages), Netgear Unite AC770S | Mobile Wifi Hotspot 4G LTE MiFI with Mint Mobile/T-Mobile SIM, all packed into a crafts box from Michaels and uploading motion-activated pictures to gmail.  Considering the uncertain viability of pass-through power banks, typically, for such an application, it's been very trouble-free.  I access the installation in Berkeley from Oakland with RealVNC https://www.realvnc.com/en/ and Amcrest provides an app that displays the camera on my Key2.

    top - 08:53:53 up 71 days, 13:07,  2 users,  load average: 0.90, 0.83, 0
    Tasks: 147 total,   1 running, 146 sleeping,   0 stopped,   0 zombie
    %Cpu(s): 13.1 us,  2.2 sy,  0.0 ni, 84.4 id,  0.0 wa,  0.0 hi,  0.3 si,
    MiB Mem :    877.3 total,     44.6 free,    268.4 used,    564.3 buff/ca
    MiB Swap:   1774.0 total,   1699.0 free,     75.0 used.    500.2 avail M

    pi@raspberrypi:~ $ inxi
    Argument "Raspberry Pi 3 Model B Plus Rev 1.3" isn't numeric in sprintf at /usr/bin/inxi line 6969.
    CPU: Quad Core ARMv7 v7l (-MCP-) speed/min/max: 1400/600/1400 MHz
    Kernel: 5.4.83-v7+ armv7l Up: 71d 13h 09m Mem: 447.9/1001.3 MiB (44.7%)
    Storage: 119.24 GiB (36.7% used) Procs: 147 Shell: bash 5.0.3 inxi: 3.0.32

    The box looked something like this, before I graduated to the Amcrest mounted on top:


  • Well, that was pretty long-winded. 😉  Let me cut to the current thread.  Around my own residence, I've added several Amcrest IP2M-852EW
    2MP ProHD POE IP Bullet cameras outdoors and kept one of the 1920TVL's in the kitchen for, primarily, monitoring the cats, skunks, raccoons, and possums who mill about.  Initially, I got this set up with the 4 cameras serving rtsp to motioneye on Raspbian GNU/Linux 10 (buster) installed to ZTC ZTC-SM201-064G - 64GB M.2 NGFF 2242 42mm Solid State SSD housed in Argon ONE M.2 Case with a Pi 4.

    pi@pi48g:~ $ inxi
    Argument "Raspberry Pi 4 Model B Rev 1.4" isn't numeric in sprintf at /usr/bin/inxi line 6969.
    CPU: Quad Core ARMv7 v7l (-MCP-) speed/min/max: 1500/600/1500 MHz
    Kernel: 5.10.17-v7l+ armv7l Up: 110d 21h 18m Mem: 507.1/7950.3 MiB (6.4%)
    Storage: 59.63 GiB (5.4% used) Procs: 156 Shell: bash 5.0.3 inxi: 3.0.32

    top - 09:44:03 up 110 days, 21:19,  3 users,  load average: 2.47, 2.14, 2.14
    Tasks: 157 total,   1 running, 156 sleeping,   0 stopped,   0 zombie
    %Cpu(s): 23.6 us,  3.1 sy,  0.0 ni, 72.2 id,  0.0 wa,  0.0 hi,  1.1 si,  0.0 st
    MiB Mem :   7874.3 total,   6704.3 free,    391.8 used,    778.2 buff/cache
    MiB Swap:    100.0 total,    100.0 free,      0.0 used.   7019.0 avail Mem

    pi@pi48g:~ $ throttle
    frequency(48)=1500345728
    frequency(1)=500000992
    temp=51.6'C
    throttled=0x0
    volt=0.8700V
    pi@pi48g:~ $ cat `which throttle`
    vcgencmd measure_clock arm; vcgencmd measure_clock core; vcgencmd measure_temp; vcgencmd get_throttled; vcgencmd measure_volts core
    pi@pi48g:

  • I was having issues with lag developing over time and the 4 feeds on 4 monitors becoming unresponsive.  I kept having to restart motioneye and reboot the pi, couldn't figure it out.  So, I thought to install motioneye to a more powerful machine on the LAN.

    [rolf@z170i ~]$ inxi
    CPU: Quad Core Intel Core i5-6500 (-MCP-) speed/min/max: 3499/800/3600 MHz
    Kernel: 5.10.60-desktop-2.mga8 x86_64 Up: 3d 13h 34m Mem: 3063.9/15879.8 MiB (19.3%)
    Storage: 149.06 GiB (57.4% used) Procs: 287 Shell: Bash inxi: 3.2.01

    Initially, that was running mga7 and using Python2, which was hunky-dory.  Soon after, though, Magiea upgraded to 8 with Python 3, as most distros have been doing this year.  Motioneye would not work and I reached out to the group, with the record of that saga being, mostly, contained herein.

  • Kevin pointed me to docker and helped me to get it set up.  However, each time I re-booted, I had to go through several steps to set the timezone, import camera settings, and struggle with not-straightforward or comprehensive docker commands to perform administration of the filesystem.  What's worse, I was also running into the lag/unresponsive problem that was a lot more difficult to recover from with periodic restarts of motioneye or reboot of the system.  Taking another look at the camera settings, I found I had set "Still Images" on one of the cameras to "Interval Snapshots" or "All Frames".  The lag and unresponsiveness coincided with memory getting filled up with all the stored images.  Once I changed the setting to "Manual" and deleted the files, docker has been working fine, apart from the mentioned shortcomings.  After a while, I changed my camera http:// access back to the good ol' Raspberry Pi 4 Model B Rev 1.4 and that, also, has been working fine.  Apparently, the problem was storing too much media.  The End.
Thanks to Kevin, Calin Crisan, and all who make this possible.
Rolf


On 5/11/21 6:38 PM, Rolf Pedersen wrote:

I've got it functional, for this boot, anyway, thanks.  Some points:

  • The Mageia docker implementation, apparently, gives an IP not on my LAN to it: 
    docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
    ... whereas:
    enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.1.116  netmask 255.255.255.0  broadcast 192.168.1.255
    ...

    I found this got the server "exposed" on the LAN:  $ docker run --network=host ccrisan/motioneye:master-amd64
    and I'm now able to access the webpage, import saved settings, set up camera views on separate monitors, as is my design.

  • The missing cgroup mount error returned, I'm guessing because systemd removed my mount point as crafted, below, and mounted its own cgroup2.  I re-made the directory and mounted in order to get docker run to work.  I can probably figure out a way to make this survive a reboot.
    [rolf@z170i ~]$ mount | grep cgroup
    cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime)
    cgroup on /sys/fs/cgroup/systemd type cgroup (rw,relatime,name=systemd)

  • I searched and learned how to get into the docker filesystem in order to, for one thing, correct the displayed time to my liking:
    docker exec 4b2c9284890c ln -sf /usr/share/zoneinfo/Etc/GMT+7 /etc/localtime

Looks like I can make some progress from here, if you want to take a break on your Mageia learning curve. ;)

Until I have to pull the fire alarm, thanks, again!
Rolf

On 5/11/21 11:53 AM, Kevin Shumaker wrote:
motionEye should be found at the IP of the docker server thus:
http:[ip_address]:8765
The docker runs like it was installed on another OS (which it is in comparison to motioneyeos.
You aren't forwarding 8081 (first camera) so you wouldn't be able to see the camera directly.
-p 8081:8081


On Tue, May 11, 2021 at 2:46 PM Rolf Pedersen <rol...@gmail.com> wrote:
Howdy,
Let me try to give you an idea of what I tried.  First, I installed docker from Magiea8 repos.  Then, I followed instructions revealed by a google search on docker motioneye terms, maybe you will recognize them, below.  Searching on one error led me to create a mount point for cgroup, mount it, and add an entry to fstab.  That cleared whatever error but I don't recall at what point, exactly, I did that.  History might be relevant: 

[rolf@z170i docker]$ history | grep cgroup
  750  rpm -qa | grep cgroup
  751  cgroup --version
  752  rpm -qa cgroup
  753  rpm -ql cgroup
  754  less /usr/share/doc/cgroup/README.Mageia
  770  ls /sys/fs/cgroup/docker/
  771  ls /sys/fs/cgroup/
  772  sudo mkdir /sys/fs/cgroup/systemd
  773  sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
  844  sudo mkdir /sys/fs/cgroup/systemd
  845  sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
  849  sudo umount cgroup
  851  sudo mount cgroup
 1015  mount | grep cgroup
 1016  history | grep cgroup
[rolf@z170i docker]$

After many failed attempts at CLI starting docker, ps showed it running but web browser could not connect.  I made sure the firewalls on the involved machines on the LAN were turned off.  Finally, thinking it was a configuration problem, I attempted to copy known good configurations from the filesystem to the docker.  The following history ought to give a rough idea of commands tried in chronological order.  Finally, I seem to have the motioneye docker installed but can't figure out how to start it and access the server on the LAN.  (Box IP is 192.168.1.116)
Thanks

[rolf@z170i docker]$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              e951096aa9b1        46 hours ago        77.9MB
<none>              <none>              914678ae9436        46 hours ago        77.9MB
<none>              <none>              ff1adba15305        46 hours ago        77.9MB
<none>              <none>              87cd33aeb70c        46 hours ago        77.9MB
debian              buster-slim         48e774d3c4f5        4 weeks ago         69.3MB
ccrisan/motioneye   master-amd64        692eccfe45a6        17 months ago       411MB

[rolf@z170i docker]$ history | grep docker
  731  rpm -q docker
  732  sudo urpmi docker
  733  docker run --name="motioneye"     -p 8765:8765     --hostname="motioneye"     -v /etc/localtime:/etc/localtime:ro     -v /etc/motioneye:/etc/motioneye     -v /var/lib/motioneye:/var/lib/motioneye     --restart="always"     --detach=true     ccrisan/motioneye:master-amd64
  734  docker run --help
  740  ps aux | grep docker
  741  docker --help
  742  docker run --name="motioneye"     -p 8765:8765     --hostname="motioneye"     -v /etc/localtime:/etc/localtime:ro     -v /etc/motioneye:/etc/motioneye     -v /var/lib/motioneye:/var/lib/motioneye     --restart="always"     --detach=true     ccrisan/motioneye:master-amd64
  743  sudo systemctl enable docker
  744  sudo systemctl start docker
  745  ps aux | grep docker
  746  docker run --name="motioneye"     -p 8765:8765     --hostname="motioneye"     -v /etc/localtime:/etc/localtime:ro     -v /etc/motioneye:/etc/motioneye     -v /var/lib/motioneye:/var/lib/motioneye     --restart="always"     --detach=true     ccrisan/motioneye:master-amd64
  747  sudo docker run --name="motioneye"     -p 8765:8765     --hostname="motioneye"     -v /etc/localtime:/etc/localtime:ro     -v /etc/motioneye:/etc/motioneye     -v /var/lib/motioneye:/var/lib/motioneye     --restart="always"     --detach=true     ccrisan/motioneye:master-amd64
  749  rpm -q docker
  757  mkdir docker
  758  cd docker/
  761  sudo usermod -aG docker $(whoami)
  764  cat /etc/group | grep docker
  766  cd docker/
  769  docker build --build-arg VCS_REF=$(git rev-parse HEAD) --build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") -t ccrisan/motioneye:master-amd64 -f extra/Dockerfile .
  770  ls /sys/fs/cgroup/docker/
  774  docker build --build-arg VCS_REF=$(git rev-parse HEAD) --build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") -t ccrisan/motioneye:master-amd64 -f extra/Dockerfile .
  787  docker build --build-arg VCS_REF=$(git rev-parse HEAD) --build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") -t ccrisan/motioneye:master-amd64 -f extra/Dockerfile .
  789  docker build --build-arg VCS_REF=$(git rev-parse HEAD) --build-arg BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ") -t ccrisan/motioneye:master-amd64 -f extra/Dockerfile .
  791  docker
  792  docker images
  794  ps aux | grep docker
  795  docker run --help
  796  docker run --name="motioneye"     -p 8765:8765     --hostname="motioneye"     -v /etc/localtime:/etc/localtime:ro     -v /etc/motioneye:/etc/motioneye     -v /var/lib/motioneye:/var/lib/motioneye     --restart="always"     --detach=true     ccrisan/motioneye:master-amd64
  797  docker run /motioneye
  798  docker run ccrisan/motioneye
  799  docker images
  800  docker run ccrisan/motioneye:master-amd64
  827  docker --help
  828  docker images
  829  docker cp
  830  docker stop ccrisan/motioneye:master-amd64
  831  docker images
  832  docker stop 692eccfe45a6
  833  docker stop ccrisan/motioneye
  834  docker container
  835  docker container ls
  836  docker container diff ccrisan/motioneye:master-amd64
  838  docker list
  839  docker --help
  840  docker images
  842  docker start ccrisan/motioneye:master-amd64
  843  docker run ccrisan/motioneye:master-amd64
  847  docker run ccrisan/motioneye:master-amd64
  854  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:master-amd64
  855  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:master-amd64/etc/motioneye
  856  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:/etc/motioneye
  857  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye/etc/motioneye
  859  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye/etc/motioneye
  860  docker container
  861  docker container cp --help
  862  docker cp /etc/motioneye/motioneye.conf|- ccrisan/motioneye/etc/motioneye
  863  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:/etc/motioneye
  864  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:etc/motioneye
  865  docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:
  866  sudo docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:etc/motioneye
  867  sudo docker cp /etc/motioneye/motioneye.conf ccrisan/motioneye:/etc/motioneye
  868  docker ps
  869  docker cp /etc/motioneye/motioneye.conf b6c2cba6d493:/etc/motioneye/motioneye.conf
  872  docker cp /etc/motion/motion.conf b6c2cba6d493:/etc/motion/motion.conf
  874  docker cp -f /etc/motion/motion.conf b6c2cba6d493:/etc/motion/motion.conf
  876  docker cp --force /etc/motion/motion.conf b6c2cba6d493:/etc/motion/motion.conf
 1007  cd Downloads/motioneye/docker/
 1009  history | grep docker
[rolf@z170i docker]$

StarbaseSSD

unread,
Aug 27, 2021, 1:45:47 PM8/27/21
to motioneye
Greetings, Rolf.
Thoughts on needing to do non-standard things to get timezone and such re-set up.
Are you setting up volumes? You need at least 3 when starting the docker for motioneye:
-v /etc/localtime:/etc/localtime:ro
-v /etc/motioneye:/etc/motioneye
-v /var/lib/motioneye:/var/lib/motioneye
If you are using portainer, make sure you select for volumes, and not bind...
If you post your docker run, we may be able to help you.
Documentation here:

Rolf Pedersen

unread,
Aug 27, 2021, 1:54:16 PM8/27/21
to moti...@googlegroups.com

Hi,
My solution for timezone looked like this:

docker exec 7aceec5f209f ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Looks like you might be showing a way to streamline, a little, getting docker running after a reboot.  However, for now, I'm planning to stick with a fully functional native setup on the Pi, as detailed in my previous message.
Thanks,
Rolf

--
You received this message because you are subscribed to the Google Groups "motioneye" group.
To unsubscribe from this group and stop receiving emails from it, send an email to motioneye+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages