speed-camera icon indicating copy to clipboard operation
speed-camera copied to clipboard

Python version needs to be specified

Open oxivanisher opened this issue 3 years ago • 2 comments
trafficstars

In the newest debian release (11, bullseye), there is no more python command available by default. See this note on the official Debian Wiki. Since python 2 is EOL since more than two years now, the correct way would be to default to python 3. I understand that some people will have trouble with this when the OS version was not upgraded, but form a security stand point, this should be done anyways.

So, on newly installed or upgraded raspberry pi's, this project currently is not working out of the box. The following files should be updated:

$ grep -R "/usr/bin/env python" *
alpr-speed.py:#!/usr/bin/env python
makehtml.py:#!/usr/bin/env python
search-speed.py:#!/usr/bin/env python
speed-cam.py:#!/usr/bin/env python
sql-make-graph-count-totals.py:#!/usr/bin/env python
sql-make-graph-speed-ave.py:#!/usr/bin/env python
sql_speed_gt.py:#!/usr/bin/env python

It is possible to workaround this issue by installing the python-is-python3 package, but its only a hacky workaround.

The start scripts currently hide the error for the user, so they don't know why its not starting. But if somebody tries to run the python code directly, the error is:

$ ./speed-cam.py
/usr/bin/env: ‘python’: No such file or directory

I hope this helps more people with problem find this post.

oxivanisher avatar Apr 16 '22 13:04 oxivanisher

Tried a recent and updated Bullseye on a RPI. ran sudo apt install python-is-python3 says already installed. Trying to execute python-is-python3 says file not found find -name only finds a directory at* /usr/share/doc/python-is-python3*

executing env python brings up python3 command shell So it would appear that as of recently env python works on RPI. I would have to install a Debian image and do some testing but it would appear you have already done some testing.

Bullseye appears to be a bit of a train wreck on RPI as far as the picamera python library is concerned. Still waiting on replacement and not sure what I will do for backward compatibility for picamera module.

Read the debian wiki link you provided and not not much of implementation details.

Can you provide a sample python script or implementation script that implements a solution that is backward compatible.. or detailed instructions that can be added to the speed-camera wiki and main page. Thanks

On Sat, Apr 16, 2022 at 8:52 AM Marc Urben @.***> wrote:

In the newest debian release (11, bullseye), there is no more python command available by default. See this note on the official Debian Wiki https://wiki.debian.org/Python#Python_in_Debian. Since python 2 is EOL since more than two years now, the correct way would be to default to python 3. I understand that some people will have trouble with this when the OS version was not upgraded, but form a security stand point, this should be done anyways.

So, on newly installed or upgraded raspberry pi's, this project currently is not working out of the box. The following files should be updated:

$ grep -R "/usr/bin/env python" *

alpr-speed.py:#!/usr/bin/env python

makehtml.py:#!/usr/bin/env python

search-speed.py:#!/usr/bin/env python

speed-cam.py:#!/usr/bin/env python

sql-make-graph-count-totals.py:#!/usr/bin/env python

sql-make-graph-speed-ave.py:#!/usr/bin/env python

sql_speed_gt.py:#!/usr/bin/env python

It is possible to workaround this issue by installing the python-is-python3 package, but its only a hacky workaround.

The start scripts currently hide the error for the user, so they don't know why its not starting. But if somebody tries to run the python code directly, the error is:

$ ./speed-cam.py

/usr/bin/env: ‘python’: No such file or directory

I hope this helps more people with problem find this post.

— Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/113, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZG2X6QO2A3VUD2E733VFLAX5ANCNFSM5TSNB76Q . 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 Apr 16 '22 20:04 pageauc

The workaround for the script with python-is-python3 works for me also. But as the debian (and RPI OS is based on debian) state in the document, it's probably not going to be available always/forever, since everything should migrate to python3. But this is no real problem, since it would be very easy to change the .sh files to support python2 and python3.

I also tried to get more information about the picam lib and it seems, that they migrate completely to libcamera. So it will probably require some work but unfortunately I have no experience with either libraries or using a camera with python. :( Especially the following part of this blog entry sounds not great:

There is no Python interface yet. An alternative to the old Picamera, imaginatively named Picamera2, is in development. This too will integrate much more directly with established Python libraries to access things like windowing and graphics functions. Picamera2 will be developed by Raspberry Pi (unlike Picamera itself, which is actually third-party code), and this will facilitate both support and continuing future development.

On https://github.com/raspberrypi/picamera2 there is a prerelease ... this might help you.

oxivanisher avatar Apr 27 '22 17:04 oxivanisher

I am thinking of writing a new libcamera-only version based on existing code rather than try to integrate picamera and libcamera in one program..

On Wed, Apr 27, 2022 at 12:24 PM Marc Urben @.***> wrote:

The workaround for the script with python-is-python3 works for me also. But as the debian (and RPI OS is based on debian) state in the document, it's probably not going to be available always/forever, since everything should migrate to python3. But this is no real problem, since it would be very easy to change the .sh files to support python2 and python3.

I also tried to get more information about the picam lib and it seems, that they migrate completely to libcamera https://www.raspberrypi.com/news/bullseye-camera-system/. So it will probably require some work but unfortunately I have no experience with either libraries or using a camera with python. :( Hopefully the link with the blog entry can give you some help...

— Reply to this email directly, view it on GitHub https://github.com/pageauc/speed-camera/issues/113#issuecomment-1111278126, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNPKZFAGZCQGAGFZXARNATVHFZ3JANCNFSM5TSNB76Q . 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 Oct 11 '22 07:10 pageauc