Python 3.7 does not work

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Python 3.7 does not work

Post 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
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Python 3.7 does not work

Post 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
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: Python 3.7 does not work

Post 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!
User avatar
Solderbro
Posts: 80
Joined: Tuesday 18 September 2018 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Hamburg, Germany
Contact:

Re: Python 3.7 does not work

Post 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
Raspi 3B+RTC, SSD 128GB, Aeotec Gen5, Eurotronic SpiritZ, Fibaro FRGBW, Zipato PIR, Everspring AN180, Neo Coolcam Plug, Fibaro FGMS, Neo Coolcam Doorsensor, Popp Z-Weather
Thorgal789
Posts: 882
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python 3.7 does not work

Post 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.
User avatar
Solderbro
Posts: 80
Joined: Tuesday 18 September 2018 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Hamburg, Germany
Contact:

Re: Python 3.7 does not work

Post 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
Raspi 3B+RTC, SSD 128GB, Aeotec Gen5, Eurotronic SpiritZ, Fibaro FRGBW, Zipato PIR, Everspring AN180, Neo Coolcam Plug, Fibaro FGMS, Neo Coolcam Doorsensor, Popp Z-Weather
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python 3.7 does not work

Post 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
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Thorgal789
Posts: 882
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python 3.7 does not work

Post 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 ?
User avatar
Solderbro
Posts: 80
Joined: Tuesday 18 September 2018 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Hamburg, Germany
Contact:

Re: Python 3.7 does not work

Post 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
Raspi 3B+RTC, SSD 128GB, Aeotec Gen5, Eurotronic SpiritZ, Fibaro FRGBW, Zipato PIR, Everspring AN180, Neo Coolcam Plug, Fibaro FGMS, Neo Coolcam Doorsensor, Popp Z-Weather
Thorgal789
Posts: 882
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python 3.7 does not work

Post 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".
User avatar
Solderbro
Posts: 80
Joined: Tuesday 18 September 2018 15:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Hamburg, Germany
Contact:

Re: Python 3.7 does not work

Post 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:-/
Raspi 3B+RTC, SSD 128GB, Aeotec Gen5, Eurotronic SpiritZ, Fibaro FRGBW, Zipato PIR, Everspring AN180, Neo Coolcam Plug, Fibaro FGMS, Neo Coolcam Doorsensor, Popp Z-Weather
Thorgal789
Posts: 882
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python 3.7 does not work

Post 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 ^^.
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python 3.7 does not work

Post by Dnpwwo »

@Solderbro,

Python packages with pip3 need to be installed using 'sudo' (i.e 'sudo pip3 install requests')
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
Thorgal789
Posts: 882
Joined: Wednesday 15 August 2018 14:38
Target OS: -
Domoticz version:
Contact:

Re: Python 3.7 does not work

Post 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
pipiche
Posts: 2027
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:

Re: Python 3.7 does not work

Post 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 ?
User avatar
waltervl
Posts: 6689
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Python 3.7 does not work

Post 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)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest