Re: Best Practice Virtual Environment

2024-10-05 Thread Thomas Passin via Python-list

On 10/5/2024 4:27 PM, Ulrich Goebel via Python-list wrote:

Hi,

I learned to use virtual environments where ever possible, and I learned to pip 
install the required packages there.

That works quite nice at home. Now I come to deploy a Python script on a debian 
linux server, making it usable for a couple of users there.

Debian (or even Python3 itself) doesn't allow to pip install required packages 
system wide, so I have to use virtual environments even there. But is it right, 
that I have to do that for every single user?

Can someone give me a hint to find an howto for that?


One alternative is to install a different version of Python without 
replacing the system's version. For example, if the system uses Python 
3.11, install Python 3.12.  That way there is no risk of breaking system 
operation, and you can install what you like where you like.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Best Practice Virtual Environment

2024-10-05 Thread Karsten Hilbert via Python-list
Am Sat, Oct 05, 2024 at 10:27:33PM +0200 schrieb Ulrich Goebel via Python-list:

> Debian (or even Python3 itself) doesn't allow to pip install required 
> packages system wide, so I have to use virtual environments even there. But 
> is it right, that I have to do that for every single user?
>
> Can someone give me a hint to find an howto for that?

AFAICT the factual consensus appears to be

install modules as packaged by the system

you won't need anything else

If you do find how to cleanly install non-packaged modules
in a system-wide way (even if that means installing every
application into its own *system-wide* venv) - do let me
know.

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
-- 
https://mail.python.org/mailman/listinfo/python-list


Best Practice Virtual Environment

2024-10-05 Thread Ulrich Goebel via Python-list
Hi,

I learned to use virtual environments where ever possible, and I learned to pip 
install the required packages there.

That works quite nice at home. Now I come to deploy a Python script on a debian 
linux server, making it usable for a couple of users there.

Debian (or even Python3 itself) doesn't allow to pip install required packages 
system wide, so I have to use virtual environments even there. But is it right, 
that I have to do that for every single user?

Can someone give me a hint to find an howto for that?

Best regards
Ulrich

-- 
Ulrich Goebel 
-- 
https://mail.python.org/mailman/listinfo/python-list


How to check whether lip movement is significant using face landmarks in dlib?

2024-10-05 Thread marc nicole via Python-list
I am trying to assess whether the lips of a person are moving too much
while the mouth is closed (to conclude they are chewing).

I try to assess the lip movement through landmarks (dlib) :

Inspired by the mouth example (
https://github.com/mauckc/mouth-open/blob/master/detect_open_mouth.py#L17),
and using it before the following function (as a primary condition for
telling the person is chewing), I wrote the following function:

def lips_aspect_ratio(shape):
# grab the indexes of the facial landmarks for the lip
(mStart, mEnd) = (61, 68)
lip = shape[mStart:mEnd]
print(len(lip))
# compute the euclidean distances between the two sets of
# vertical lip landmarks (x, y)-coordinates
# to reach landmark 68 I need to get lib[7] not lip[6] (while I
get lip[7] I get IndexOutOfBoundError)
A = dist.euclidean(lip[1], lip[6])  # 62, 68
B = dist.euclidean(lip[3], lip[5])  # 64, 66

# compute the euclidean distance between the horizontal
# lip landmark (x, y)-coordinates
C = dist.euclidean(lip[0], lip[4])  # 61, 65

# compute the lip aspect ratio
mar = (A + B) / (2.0 * C)

# return the lip aspect ratio
return mar


How to define an aspect ratio for the lips to conclude they are moving
significantly? Is the mentioned function able to tell whether the lips
are significantly moving while the mouth is closed?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best Practice Virtual Environment

2024-10-05 Thread Cameron Simpson via Python-list

On 05Oct2024 22:27, Ulrich Goebel  wrote:
Debian (or even Python3 itself) doesn't allow to pip install required 
packages system wide,


This is gnerally a good thing. You might modify a critical system-used 
package.



But is it right, that I have to do that for every single user?


No. Just make a shared virtualenv, eg in /usr/local or /opt somewhere.
Have the script commence with:

#!/path/to/the/shred/venv/bin/python

and make it readable and executable.

Problem solved.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list