Page 1 of 1

Python 3.7 does not work

Posted: Saturday 13 July 2019 19:37
by sailmich
Rpi zero with Raspian buster light. Beta 4.10977
I did a fresh installation with all apt-get updates. I put gbridge plugin in the correct folder. After restart I would select gbridge in hardware drop down menue but it isn't there. In domoticz log I got Failed dynamic library load, install the latest libpython3.x library
I double checked that latest libpython3 is installed and matched to python version. Is it a problem with buster/domoticz or Python3.7/domoticz?
Appreciate every hint

Re: Python 3.7 does not work

Posted: Saturday 13 July 2019 21:01
by EddyG
Go back to Stretch, because you might encounter more problems with Buster on the way.
B.t.w. my test system runs fine. Did not test any plugin yet, but no error at startup of Domoticz.

Code: Select all

Status: PluginSystem: Started, Python version '3.7.3'.
Did you install the dev system?

Code: Select all

sudo apt-get install python3-dev

Re: Python 3.7 does not work

Posted: Sunday 14 July 2019 11:05
by sailmich
EddyG wrote: Saturday 13 July 2019 21:01 Go back to Stretch, because you might encounter more problems with Buster on the way.
B.t.w. my test system runs fine. Did not test any plugin yet, but no error at startup of Domoticz.

Code: Select all

Status: PluginSystem: Started, Python version '3.7.3'.
Did you install the dev system?

Code: Select all

sudo apt-get install python3-dev
I will go back to stretch. And yes I had python3-dev installed.
Thanks for your answer and comments!

Re: Python 3.7 does not work

Posted: Friday 19 July 2019 20:30
by Solderbro
Hello,

running buster light here and the python3-dev is a must to get the library to the system. Everything else works at a glance with buster-stable.

Solderbro

Re: Python 3.7 does not work

Posted: Thursday 01 August 2019 21:40
by Thorgal789
Hello, by curiosity, if you have buster and python 3.7 I presume ? Can you make a try with a python plugin and the lib requests ?
Just insert a

Code: Select all

import requests
At the top of a plugin. It seem domoticz is crashing in this situation.

Re: Python 3.7 does not work

Posted: Saturday 03 August 2019 7:53
by Solderbro
Hello,

it looks like this but domoticz stay on schedule here

2019-08-03 07:51:21.936 Error: EventSystem: Failed to execute python event script "Test"
2019-08-03 07:51:21.936 Error: EventSystem: Traceback (most recent call last):
2019-08-03 07:51:21.936 Error: EventSystem: File "<string>", line 1, in <module>
2019-08-03 07:51:21.937 Error: EventSystem: ModuleNotFoundError: No module named 'requests'

I would suggest to downgrade python packages instead of using an older debian stable. Until domoticz parts are upgraded to work better with python 3.7

Solderbro

Re: Python 3.7 does not work

Posted: Saturday 03 August 2019 10:20
by Dnpwwo
On a fresh buster (minimal) build running Python 3.7.3 the requests library import worked in Python and Domoticz.

Built from source as per instructions on the wiki.

Default version of Python for the OS (which I always recommend), requests was already installed according to pip3

Re: Python 3.7 does not work

Posted: Saturday 03 August 2019 11:09
by Thorgal789
@Solderbro, Can you try

Code: Select all

pip3 install requests
To install the missing lib. And yes it's that he have do, he is still on buster but python 3.5 now, but for me it's not a good solution, python 3.7 ill be soon a new standard.

@Dnpwwo, so on your side, if you make a complete build it works ? You haven't make a try with a normal install ?

Re: Python 3.7 does not work

Posted: Saturday 03 August 2019 15:19
by Solderbro
Yes the phyton-pip package was missing, it pulled 32MB of further packages that are installed now.

The result is

2019-08-03 15:16:22.055 Error: EventSystem: Failed to execute python event script "Test2"
2019-08-03 15:16:22.056 Error: EventSystem: File "<string>", line 1
2019-08-03 15:16:22.056 Error: EventSystem: pip3 install requests
2019-08-03 15:16:22.056 Error: EventSystem: ^
2019-08-03 15:16:22.056 Error: EventSystem: SyntaxError: invalid syntax

Solderbro

Re: Python 3.7 does not work

Posted: Saturday 03 August 2019 20:32
by Thorgal789
"pip3 install requests" is to install the lib, just type in on the console/terminal, on the python file it's still "import requests".

Re: Python 3.7 does not work

Posted: Sunday 04 August 2019 17:59
by Solderbro
Some packages did miss, so i installed both sides

domoticz@domosys:~/domoticz/www/styles $ pip --version
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)
domoticz@domosys:~/domoticz/www/styles $ pip3 --version
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

pip3 requests in now installed too, i see that there is lot of stuff to install by hand if for example the SD Card wears out.

domoticz@domosys:~/domoticz/www/styles $ pip3 install requests
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.21.0)

But back to the first test script

2019-08-04 17:52:09.342 Error: EventSystem: Failed to execute python event script "Test"
2019-08-04 17:52:09.342 Error: EventSystem: Traceback (most recent call last):
2019-08-04 17:52:09.342 Error: EventSystem: File "<string>", line 1, in <module>
2019-08-04 17:52:09.342 Error: EventSystem: ModuleNotFoundError: No module named 'requests'

Incompatible in some way:-/

Re: Python 3.7 does not work

Posted: Sunday 04 August 2019 19:03
by Thorgal789
From my memory, there was same bug before the last stable (need to add something like sys.path.insert(0,'/usr/local/lib/pythonX.X/dist-packages/') to code), but with all version after this one, the import is now working alone.

It's not the same problem but BTW thx a lot for yours tests ^^.

Re: Python 3.7 does not work

Posted: Sunday 04 August 2019 23:33
by Dnpwwo
@Solderbro,

Python packages with pip3 need to be installed using 'sudo' (i.e 'sudo pip3 install requests')

Re: Python 3.7 does not work

Posted: Monday 05 August 2019 16:51
by Thorgal789
Arf, I haven't see, my fault.

This night I will make a try on windows, and I have an old raspberry 2, just need to find another sd card to test.

Edit 1:
Works perfectly by defaut on windows and pyton 3.7.4

Re: Python 3.7 does not work

Posted: Thursday 06 January 2022 17:19
by pipiche
Dnpwwo wrote: Sunday 04 August 2019 23:33 @Solderbro,

Python packages with pip3 need to be installed using 'sudo' (i.e 'sudo pip3 install requests')
Is that still valid , or can we install he Python packages on the local user running domoticz ?

Re: Python 3.7 does not work

Posted: Thursday 06 January 2022 17:29
by waltervl
pipiche wrote: Thursday 06 January 2022 17:19
Dnpwwo wrote: Sunday 04 August 2019 23:33 @Solderbro,

Python packages with pip3 need to be installed using 'sudo' (i.e 'sudo pip3 install requests')
Is that still valid , or can we install he Python packages on the local user running domoticz ?
It depends what user is running Domoticz service. From the default installation it seems to be user root (but I am not sure)