pi-timolo icon indicating copy to clipboard operation
pi-timolo copied to clipboard

Bullseye default python version

Open MS-Stamp opened this issue 3 years ago • 5 comments

The latest Raspian build (Bullseye, Debian 11) only comes with python 3, so you have to manually install python 2 and then change the default version to get the webserver running. I used the following after a little searching on the web, but it would be good to either update the webserver for python 3 or document the workaround to support python 2.

sudo apt install python2 sudo apt install python-is-python2

MS-Stamp avatar Feb 23 '22 18:02 MS-Stamp

Code is compatible with python3 but I have not run under Bullesye. Not sure if the PiCamera python library will work since I believe they removed it from bullseye. Let me know if it works with bullseye

You can launch scripts under python 3 by manually changing the top shebang to point to python3 Also webserver3.py is compatible with python3. You can copy it over the python.py and menubox should work

Let me know how you are doing

On Wed, Feb 23, 2022 at 12:03 PM Sam Stamp @.***> wrote:

The latest Raspian build (Bullseye, Debian 11) only comes with python 3, so you have to manually install python 2 and then change the default version to get the webserver running. I used the following after a little searching on the web, but it would be good to either update the webserver for python 3 or document the workaround to support python 2.

sudo apt install python2 sudo apt install python-is-python2

— Reply to this email directly, view it on GitHub https://github.com/pageauc/pi-timolo/issues/125, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZBC3AHOA3CJRK2MPZLU4UOPRANCNFSM5PFDHMVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- YouTube Channel at https://www.youtube.com/user/pageaucp http://www.youtube.com/user/pageaucp GitHub Repository at https://github.com/pageauc

pageauc avatar Feb 23 '22 18:02 pageauc

I haven't had any luck with this under bullseye / python3. I'm new to the script, but got it working without issues a few months back. When I returned, I started afresh with a new SD image, which I assume included the OS update.

hugh@zerotwo:~/pi-timolo $ ./pi-timolo.py
-------------------------------------------------------
pi-timolo.py ver 12.52  written by Claude Pageau
-------------------------------------------------------
Loading Wait ....
WARN  : Could Not Import pyexiv2. Required for Saving Image EXIF meta data
        If Running under python3 then Install pyexiv2 library for python3 per
        cd ~/pi-timolo
        ./install-py3exiv2.sh

Please Review Warnings  Wait 10 sec ...
Loading Wait ....
Traceback (most recent call last):
  File "/home/hugh/pi-timolo/./pi-timolo.py", line 395, in <module>
    from picamera import PiCamera
  File "/usr/lib/python3/dist-packages/picamera/__init__.py", line 72, in <module>
    from picamera.exc import (
  File "/usr/lib/python3/dist-packages/picamera/exc.py", line 41, in <module>
    import picamera.mmal as mmal
  File "/usr/lib/python3/dist-packages/picamera/mmal.py", line 49, in <module>
    _lib = ct.CDLL('libmmal.so')
  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libmmal.so: cannot open shared object file: No such file or directory

libmmal.so is present:

hugh@zerotwo:~/opencv3-setup $ ls /opt/vc/lib/libm*
/opt/vc/lib/libmmal_components.so  /opt/vc/lib/libmmal.so       /opt/vc/lib/libmmal_vc_client.so
/opt/vc/lib/libmmal_core.so        /opt/vc/lib/libmmal_util.so

I have enabled the legacy camera stack via rpi-config

I'm running on a Pi Zero 2 W. The github readme for python 3 suggests you need to build OpenCV, but when I download and run your build / install script, I get this:

./cv3-install-menu.sh ver 3.82    written by Claude Pageau

Internet Check OpenCV version 4.1.2  Wait ...

STATUS
Current Installed python OpenCV version is 4.5.1
Variable OPENCV_VER=4.1.2 Is a Valid OpenCV Version

UPGRADE
python OpenCV Version From 4.5.1
                       To  4.1.2

Which suggests a manual build is unnecessary?

hughc avatar Mar 21 '22 23:03 hughc

There should be a setting using sudo raspi-config under Interface Options, called I1 Legacy Camera Enable/disable legacy camera support. Try enabling this option then try to reinstall/rerun pi-timolo. I Have not tried this but you could test to see if it will support the legacy picamera python library. Let me know if this works.

There should be not opencv issues and code can run under python2 or 3

Claude ....

On Mon, Mar 21, 2022 at 6:11 PM hughc @.***> wrote:

I haven't had any luck with this under bullseye / python3. I'm new to the script, but got it working without issues a few months back. When I returned, I started afresh with a new SD image, which I assume included the OS update.

@.***:~/pi-timolo $ ./pi-timolo.py

pi-timolo.py ver 12.52 written by Claude Pageau

Loading Wait .... WARN : Could Not Import pyexiv2. Required for Saving Image EXIF meta data If Running under python3 then Install pyexiv2 library for python3 per cd ~/pi-timolo ./install-py3exiv2.sh

Please Review Warnings Wait 10 sec ... Loading Wait .... Traceback (most recent call last): File "/home/hugh/pi-timolo/./pi-timolo.py", line 395, in from picamera import PiCamera File "/usr/lib/python3/dist-packages/picamera/init.py", line 72, in from picamera.exc import ( File "/usr/lib/python3/dist-packages/picamera/exc.py", line 41, in import picamera.mmal as mmal File "/usr/lib/python3/dist-packages/picamera/mmal.py", line 49, in _lib = ct.CDLL('libmmal.so') File "/usr/lib/python3.9/ctypes/init.py", line 374, in init self._handle = _dlopen(self._name, mode) OSError: libmmal.so: cannot open shared object file: No such file or directory

libmmal.so is present:

@.**:~/opencv3-setup $ ls /opt/vc/lib/libm /opt/vc/lib/libmmal_components.so /opt/vc/lib/libmmal.so /opt/vc/lib/libmmal_vc_client.so /opt/vc/lib/libmmal_core.so /opt/vc/lib/libmmal_util.so

I have enabled the legacy camera stack via rpi-config

I'm running on a Pi Zero 2 W. The github readme for python 3 suggests you need to build OpenCV, but when I download and run your build / install script, I get this:

./cv3-install-menu.sh ver 3.82 written by Claude Pageau

Internet Check OpenCV version 4.1.2 Wait ...

STATUS Current Installed python OpenCV version is 4.5.1 Variable OPENCV_VER=4.1.2 Is a Valid OpenCV Version

UPGRADE python OpenCV Version From 4.5.1 To 4.1.2

Which suggests a manual build is unnecessary?

— Reply to this email directly, view it on GitHub https://github.com/pageauc/pi-timolo/issues/125#issuecomment-1074511321, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZCGO3O4CTANFGZABMDVBD6YRANCNFSM5PFDHMVA . You are receiving this because you commented.Message ID: @.***>

-- YouTube Channel at https://www.youtube.com/user/pageaucp http://www.youtube.com/user/pageaucp GitHub Repository at https://github.com/pageauc

pageauc avatar Mar 22 '22 04:03 pageauc

Sorry, I did not accurately explain that I had already enabled legacy camera support (I mentioned rpi-config, rather than raspi-config).

The result remains the same, still seeing the libmmal error as previously quoted. This, after reinstalling after double-checking that camera support was enabled.

hughc avatar Mar 22 '22 06:03 hughc

Thanks for the update

Until the new Bullseye and later picamera python library is released and the pi-timilo code changed to work with that library then the only alternative is to use raspberry pi OS prior to Bullseye You can thank the raspberry pi OS team for the No Pain, No Gain attitude

On Tue, Mar 22, 2022 at 1:54 AM hughc @.***> wrote:

Sorry, I did not accurately explain that I had already enabled legacy camera support (I mentioned rp-config, rather than raspi-config).

The result remains the same, still seeing the libmmal error as previously quoted. This, after reinstalling after double-checking that camera support was enabled.

— Reply to this email directly, view it on GitHub https://github.com/pageauc/pi-timolo/issues/125#issuecomment-1074801462, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZG22SAUUVAIMQ5NJ6LVBFVDXANCNFSM5PFDHMVA . You are receiving this because you commented.Message ID: @.***>

-- YouTube Channel at https://www.youtube.com/user/pageaucp http://www.youtube.com/user/pageaucp GitHub Repository at https://github.com/pageauc

pageauc avatar Mar 22 '22 12:03 pageauc