Re: [Owfs-developers] Installing pyownet

2019-10-28 Thread Mick Sulley

Hi Stefano,

Thanks for the reply and thank you for developing pyownet and making it 
available.  I have been using it for many years now.


I have always been confused over the use of sudo when installing 
packages, my approach has generally been to not use sudo and see if it 
all works as expected, if it doesn't then try installing with sudo.


The current system I am working on runs on a Raspberry Pi and has 2 
programs, one which sets up the config for owfs alias file, log files 
etc and needs to by run with sudo, but only needs to be run when I have 
changed setup somehow, the other can run as a normal user and runs 
permanently.


I have read through you explanation of installing in a virtual 
environment and I have a few practical concerns.  First I am not sure my 
Linux and/or python skills are up to it.  Second as there will only ever 
be one user on this system I don't think is offers great benefits.  
Third I will only be installing the one package, pyownet, with sudo, so 
I don't think there are any serious security risks.


Thanks for your help

Mick

On 28/10/2019 21:57, Stefano Miccoli via Owfs-developers wrote:

There is little bit of confusion.

The official OWFS bindings are

- OW.py, based on SWIG wrapping the C API of libow
- ownet.py, pure python owserver client

you will find both in debian packages

- python-ow, https://packages.debian.org/buster/python-ow
- python-ownet, https://packages.debian.org/buster/python-ownet

My advice is to avoid the use of these packages with python3 (although 
python3 versions exist in debian) since they are not actively developed.


I’m the author of pyownet, a different package, which does not belong 
to the official OWFS code base. It is documented at 
 and is available only on 
pypi.org  since, to my knowledge, it is not packaged 
by any major linux distribution.


pyownet is actively mantained, and is perfectly compatible with both 
python3 (up from 3.3) and legacy python2 (2.7 only).


So if you “import pyownet” in your code you have to “pip install 
pyownet”. The discussion in this thread is whether it is a good 
practice to “sudo pip install pyownet” along the python packages 
distributed by debian. In my opinion you should avoid this, and 
instead use a virtual environment, as I tried to explain in my messages.


Bye

Stefano


On 28 Oct 2019, at 00:34, Mick Sulley > wrote:


But that webpage says -

To install pyownet:

$ pip install pyownet



On 27/10/2019 17:09, Martin Patzak wrote:

No, pyownet is not part of ownet.

Type "man ownet"

pyownet has to be installed through pypi

maybe you find more info here:
https://github.com/miccoli/pyownet


On 27.10.19 14:54, Mick Sulley wrote:
I am confused.  pyownet seems to be working with Python3 for me if 
I install it as


sudo pip3 install pyownet

that is unless there are some features of it that I have not used.  
Is pyownet included within python3-ownet, or have i misunderstood 
that?


Also on the pypi site https://pypi.org/project/pyownet/ it says 
that Python3 is fully supported and to install it use  'pip install 
pyownet'


I have looked for asyncowfs and cannot find it anywhere.  Can you 
point me to a web page please?


Thanks

Mick

On 27/10/2019 10:26, Matthias Urlichs via Owfs-developers wrote:

Hi,

Debian: "sudo apt install python3-ownet" (or the GUI equivalent).

Having just done that …

(a) the module is named "ownet" not "pyownet"

(b) This module doesn't work with python3. Like, at all. I have 
created
https://github.com/owfs/owfs/pull/44 to (barely) fix that, and I 
sent a

bug report to Debian which should eventually show up on
https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=python3-ownet .

Personally I use asyncowfs …




___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers



___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net 


https://lists.sourceforge.net/lists/listinfo/owfs-developers




___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-28 Thread Stefano Miccoli via Owfs-developers
There is little bit of confusion.

The official OWFS bindings are

- OW.py, based on SWIG wrapping the C API of libow
- ownet.py, pure python owserver client

you will find both in debian packages 

- python-ow, https://packages.debian.org/buster/python-ow 

- python-ownet, https://packages.debian.org/buster/python-ownet 


My advice is to avoid the use of these packages with python3 (although python3 
versions exist in debian) since they are not actively developed.

I’m the author of pyownet, a different package, which does not belong to the 
official OWFS code base. It is documented at 
> and is available only on pypi.org 
 since, to my knowledge, it is not packaged by any major 
linux distribution. 

pyownet is actively mantained, and is perfectly compatible with both python3 
(up from 3.3) and legacy python2 (2.7 only). 

So if you “import pyownet” in your code you have to “pip install pyownet”. The 
discussion in this thread is whether it is a good practice to “sudo pip install 
pyownet” along the python packages distributed by debian. In my opinion you 
should avoid this, and instead use a virtual environment, as I tried to explain 
in my messages.

Bye

Stefano


> On 28 Oct 2019, at 00:34, Mick Sulley  wrote:
> 
> But that webpage says -
> 
> To install pyownet:
> 
> $ pip install pyownet
> 
> 
> 
> On 27/10/2019 17:09, Martin Patzak wrote:
>> No, pyownet is not part of ownet.
>> 
>> Type "man ownet" 
>> 
>> pyownet has to be installed through pypi
>> 
>> maybe you find more info here:
>> https://github.com/miccoli/pyownet 
>> 
>> 
>> On 27.10.19 14:54, Mick Sulley wrote:
>>> I am confused.  pyownet seems to be working with Python3 for me if I 
>>> install it as 
>>> 
>>> sudo pip3 install pyownet 
>>> 
>>> that is unless there are some features of it that I have not used.  Is 
>>> pyownet included within python3-ownet, or have i misunderstood that? 
>>> 
>>> Also on the pypi site https://pypi.org/project/pyownet/ 
>>>   it says that Python3 is fully 
>>> supported and to install it use  'pip install pyownet' 
>>> 
>>> I have looked for asyncowfs and cannot find it anywhere.  Can you point me 
>>> to a web page please? 
>>> 
>>> Thanks 
>>> 
>>> Mick 
>>> 
>>> On 27/10/2019 10:26, Matthias Urlichs via Owfs-developers wrote: 
 Hi, 
> Debian: "sudo apt install python3-ownet" (or the GUI equivalent). 
 Having just done that … 
 
 (a) the module is named "ownet" not "pyownet" 
 
 (b) This module doesn't work with python3. Like, at all. I have created 
 https://github.com/owfs/owfs/pull/44 
  to (barely) fix that, and I sent a 
 bug report to Debian which should eventually show up on 
 https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=python3-ownet 
  . 
 
 Personally I use asyncowfs … 
 
>>> 
>>> 
>>> ___ 
>>> Owfs-developers mailing list 
>>> Owfs-developers@lists.sourceforge.net 
>>>  
>>> https://lists.sourceforge.net/lists/listinfo/owfs-developers 
>>>  
>> 
> ___
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers

___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-27 Thread Mick Sulley

But that webpage says -

To install pyownet:

$ pip install pyownet



On 27/10/2019 17:09, Martin Patzak wrote:

No, pyownet is not part of ownet.

Type "man ownet"

pyownet has to be installed through pypi

maybe you find more info here:
https://github.com/miccoli/pyownet


On 27.10.19 14:54, Mick Sulley wrote:
I am confused.  pyownet seems to be working with Python3 for me if I 
install it as


sudo pip3 install pyownet

that is unless there are some features of it that I have not used.  
Is pyownet included within python3-ownet, or have i misunderstood that?


Also on the pypi site https://pypi.org/project/pyownet/ it says that 
Python3 is fully supported and to install it use 'pip install pyownet'


I have looked for asyncowfs and cannot find it anywhere.  Can you 
point me to a web page please?


Thanks

Mick

On 27/10/2019 10:26, Matthias Urlichs via Owfs-developers wrote:

Hi,

Debian: "sudo apt install python3-ownet" (or the GUI equivalent).

Having just done that …

(a) the module is named "ownet" not "pyownet"

(b) This module doesn't work with python3. Like, at all. I have created
https://github.com/owfs/owfs/pull/44 to (barely) fix that, and I sent a
bug report to Debian which should eventually show up on
https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=python3-ownet .

Personally I use asyncowfs …




___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-27 Thread Mick Sulley
I am confused.  pyownet seems to be working with Python3 for me if I 
install it as


sudo pip3 install pyownet

that is unless there are some features of it that I have not used.  Is 
pyownet included within python3-ownet, or have i misunderstood that?


Also on the pypi site https://pypi.org/project/pyownet/  it says that 
Python3 is fully supported and to install it use  'pip install pyownet'


I have looked for asyncowfs and cannot find it anywhere.  Can you point 
me to a web page please?


Thanks

Mick

On 27/10/2019 10:26, Matthias Urlichs via Owfs-developers wrote:

Hi,

Debian: "sudo apt install python3-ownet" (or the GUI equivalent).

Having just done that …

(a) the module is named "ownet" not "pyownet"

(b) This module doesn't work with python3. Like, at all. I have created
https://github.com/owfs/owfs/pull/44 to (barely) fix that, and I sent a
bug report to Debian which should eventually show up on
https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=python3-ownet .

Personally I use asyncowfs …




___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-27 Thread Matthias Urlichs via Owfs-developers
Hi,
> Debian: "sudo apt install python3-ownet" (or the GUI equivalent). 

Having just done that …

(a) the module is named "ownet" not "pyownet"

(b) This module doesn't work with python3. Like, at all. I have created
https://github.com/owfs/owfs/pull/44 to (barely) fix that, and I sent a
bug report to Debian which should eventually show up on
https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=python3-ownet .

Personally I use asyncowfs …

-- 
-- Matthias Urlichs




___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-27 Thread Stefano Miccoli via Owfs-developers
pyownet is only on pypi, not on debian: you have to use the virtualenv method.

S.

> On 27 Oct 2019, at 01:01, Mick Sulley  wrote:
> 
> I have a problem with that.  I removed pyownet with
> 
> sudo pip3 uninstall pyownet
> 
> then I reinstalled with
> 
> sudo apt install pyownet
> 
> but that gave me
> 
> E: Unable to locate package pyownet
> 
> so I ran
> 
> sudo apt install python3-ownet
> 
> which seemed to complete OK, but when I run my code it fails with
> 
> ModuleNotFoundError: No module named 'pyownet'
> 
> am I missing something here?
> 
> 
> On 26/10/2019 15:24, Matthias Urlichs via Owfs-developers wrote:
>> On 26.10.19 12:53, Mick Sulley wrote:
>>> Question - is it good practice to always install packages like this as
>>> root?
>> On Linux, best practice is to not use "pip" if the distribution already
>> has a package for whatever you need. Debian: "sudo apt install
>> python3-ownet" (or the GUI equivalent).
>> 
> 
> 
> ___
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers



___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-26 Thread Mick Sulley

I have a problem with that.  I removed pyownet with

    sudo pip3 uninstall pyownet

then I reinstalled with

    sudo apt install pyownet

but that gave me

    E: Unable to locate package pyownet

so I ran

    sudo apt install python3-ownet

which seemed to complete OK, but when I run my code it fails with

    ModuleNotFoundError: No module named 'pyownet'

am I missing something here?


On 26/10/2019 15:24, Matthias Urlichs via Owfs-developers wrote:

On 26.10.19 12:53, Mick Sulley wrote:

Question - is it good practice to always install packages like this as
root?

On Linux, best practice is to not use "pip" if the distribution already
has a package for whatever you need. Debian: "sudo apt install
python3-ownet" (or the GUI equivalent).




___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-26 Thread Stefano Miccoli via Owfs-developers
Best practice is to isolate packages downloaded from pypi  in 
a virtual environment, and do not mess with the system wide python installation.

As a general rule always avoid “sudo pip install”, and only install system wide 
python packages via the distribution package manager (apt for debian, pacman 
for archlinux, yum and dnf for rpm based distros, etc.).

Of course the number of wonderful python packages on pypi  is 
amazing, so soon or later you will need some python package which is not 
available in your distro. Moreover sometimes different packages have 
conflicting requirements, hence the necessity of isolated virtual environments, 
explained in 



So you should (python == python3 below)

$ python -m venv /opt/XXX
$ source /opt/XXX/bin/activate
$ pip install yyy

Now every user wishing to use the XXX virtual env should simply

$ source /opt/XXX/bin/activate
$ python
>>> import yyy

One question remains open: should you run "python -m venv /opt/XXX” and the 
subsequent commands as root, or not? Here the matter become complex, as is 
security is under all Unix systems.

Oversimplifying you have two options. If you blindly trust every package in 
pypi you can 

$ sudo python -m venv /opt/XXX
$ source /opt/XXX/bin/activate
$ sudo pip install yyy

or if you are a little paranoid (like myself) you should create a user (say 
Mousebender) just for managing the virtual environments:

$ sudo mkdir /opt/XXX
$ sudo chown Mousebender /opt/XXX
$ sudo -u Mousebender python -m venv /opt/XXX
$ source /opt/XXX/bin/activate
$ sudo -u Mousebender pip install yyy

(There are also other more advanced options, like building with a non 
privileged user a set of python wheels and installing them as root, but I will 
not discuss them here.)

I’m not aware of any harmful package on pypi, and I know for sure that most 
people simply do “sudo pip install” in a virtual environment, but you should be 
aware that a python source package installation can execute arbitrary code, and 
that it is usually a bad idea to run foreign code as root, without a security 
audit first.


Regards,

Stefano

> On 26 Oct 2019, at 12:53, Mick Sulley  wrote:
> 
> I have just discovered that if I install pyownet with
> 
> pip3 install pyownet
> 
> it works fine for programs that I run under my user, but if I run something 
> with sudo I get
> 
> ModuleNotFoundError: No module named 'pyownet'
> 
> I can overcome this by installing as root with
> 
> sudo pip3 install pyownet
> 
> 
> Question - is it good practice to always install packages like this as root?
> 
> Thanks
> 
> Mick
> 
> 
> 
> ___
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers



___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Installing pyownet

2019-10-26 Thread Matthias Urlichs via Owfs-developers
On 26.10.19 12:53, Mick Sulley wrote:
> Question - is it good practice to always install packages like this as
> root? 

On Linux, best practice is to not use "pip" if the distribution already
has a package for whatever you need. Debian: "sudo apt install
python3-ownet" (or the GUI equivalent).

-- 
-- Matthias Urlichs



___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


[Owfs-developers] Installing pyownet

2019-10-26 Thread Mick Sulley

I have just discovered that if I install pyownet with

pip3 install pyownet

it works fine for programs that I run under my user, but if I run 
something with sudo I get


ModuleNotFoundError: No module named 'pyownet'

I can overcome this by installing as root with

sudo pip3 install pyownet


Question - is it good practice to always install packages like this as root?

Thanks

Mick



___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers