How to use self compiled python for domoticz build

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
User avatar
joba1
Posts: 19
Joined: Saturday 03 March 2018 16:39
Target OS: Linux
Domoticz version: V2024.7
Location: DE
Contact:

How to use self compiled python for domoticz build

Post by joba1 »

Hi,

I have difficulties building my own domoticz version with my own python version.
The error message during cmake is

Code: Select all

-- Could NOT find Python3 (missing: Python3_LIBRARIES Python3_INCLUDE_DIRS Development) (Required is at least version "3.4")
CMake Error at CMakeLists.txt:449 (MESSAGE):
  Python3 not found on your system, use USE_PYTHON=NO or sudo apt-get install
  python3-dev)
I need this because I have written a plugin for domoticz that automatically creates switches and sensors for tasmota devices and want to test it with different python versions.

To get a python version I use this getpy.sh script:

Code: Select all

#!/bin/bash

# get version (like available in ftp_url) and directory where to install
# needs relevant dev packages installed: 
# zypper in tk-devel sqlite3-devel gdbm-devel readline6-devel openssl-devel libffi-devel

ver="${1-3.10.10}"
dir="${2-$PWD}"

instdir="$dir/python-$ver"
echo "Installing python to '$instdir'"
mkdir -p "$instdir"
cd "$instdir"
wget -O- "https://www.python.org/ftp/python/$ver/Python-$ver.tar.xz" | tar xJf -
cd "Python-$ver"
./configure --enable-optimizations --with-lto=full --enable-shared --prefix="$instdir" --libdir="$instdir/lib"
make -j8
make install
"$instdir/bin/python3" -m venv "$instdir/venv/base"
. "$instdir/venv/base/bin/activate"
python3 --version
To compile domoticz I follow https://www.domoticz.com/wiki/Build_Dom ... rom_source

On Opensuse Tumbleweed I have cmake 3.17.3 and boost 1_81_0.
I compiled and installed z-wave with tag 1.6 (latest has compile error about null values)
So I think I meet the requirements.

What do I need in addition to make the domoticz build find my python?

Code: Select all

(base) job4:~/domoticz > python --version
Python 3.10.10
(base) job4:~/domoticz > which python
/home/domoticz/python-3.10.10/venv/base/bin/python
(base) job4:~/domoticz > ls /home/domoticz/python-3.10.10
bin  include  lib  Python-3.10.10  share  venv
User avatar
joba1
Posts: 19
Joined: Saturday 03 March 2018 16:39
Target OS: Linux
Domoticz version: V2024.7
Location: DE
Contact:

Re: How to use self compiled python for domoticz build

Post by joba1 »

I did some research and found this: In CMakeLists.txt the first line fails while the second works:

Code: Select all

find_package(Python3 3.4 COMPONENTS Development)
find_package(Python  3.4 COMPONENTS Development)
I have no idea why cmake works this way... :?

...and it only helps in a mini CMakeLists.txt, not in the one from domoticz...
User avatar
joba1
Posts: 19
Joined: Saturday 03 March 2018 16:39
Target OS: Linux
Domoticz version: V2024.7
Location: DE
Contact:

Re: How to use self compiled python for domoticz build

Post by joba1 »

nevermind, a newer cmake (3.25.3) and cleaning old cmake files solved the problem.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest