Pydmodbus install with venv environment

Python and python framework

Moderator: leecollings

Post Reply
Pchatill
Posts: 36
Joined: Wednesday 16 September 2015 5:52
Target OS: Raspberry Pi / ODroid
Domoticz version: v2026.2
Location: France
Contact:

Pydmodbus install with venv environment

Post by Pchatill »

Hi everybody.
I try to work with a domoticz-Solax-plugin
For that, I need to install pymodbus in a venv environment and I followed the wiki:
mkdir Domoticz_Python_Environment
python3 -m venv Domoticz_Python_Environment
source Domoticz_Python_Environment/bin/activate
pip install --upgrade pip
pip install pymodbus==3.13.0
I modified the init.d like that:
export PYTHONPATH=/home/pi/Domoticz_Python_Environment:$PYTHONPATH
python3 --version --->Python 3.13.5
pip show pymodbus --->version: 3.13.0 (only when venv is activated)
After boot, venv looks deactivated and pip show pymodbus --->"WARNING: Package(s) not found: pymodbus", but I think it's normal
When I enable The domoticz-Solax-plugin harware, the log show:
2026-07-27 07:26:17.910 Error: Modbus Solax: (SolaxMODBUS) failed to load 'plugin.py'.
2026-07-27 07:26:17.931 Error: Modbus Solax: Traceback (most recent call last):
2026-07-27 07:26:17.931 Error: Modbus Solax: File "/home/pi/domoticz/plugins/Domoticz-Solax-plugin/plugin.py", line 28, in <module>
2026-07-27 07:26:17.931 Error: Modbus Solax: from pymodbus.client import ModbusTcpClient
2026-07-27 07:26:17.931 Error: Modbus Solax: ModuleNotFoundError: No module named 'pymodbus'
pydmodbus is not find.
Do I need to install my 'Domoticz-Solax-plugin' somewhere else than /home/pi/Domoticz/plugins?

I'm stuck. Any suggestion?
jannl
Posts: 870
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1.x
Location: Geleen
Contact:

Re: Pydmodbus install with venv environment

Post by jannl »

In my 2026.2 docker I still use pymodbus 3.6.9, seems to work ok.

Code: Select all

pip3 install pymodbus==3.6.9
In my customstart.sh
Pchatill
Posts: 36
Joined: Wednesday 16 September 2015 5:52
Target OS: Raspberry Pi / ODroid
Domoticz version: v2026.2
Location: France
Contact:

Re: Pydmodbus install with venv environment

Post by Pchatill »

Thanks for reply Janni.
Do you use pymodbus for the Domoticz-solax-plugin?
User avatar
imautohuttraeger
Posts: 393
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Germany
Contact:

Re: Pydmodbus install with venv environment

Post by imautohuttraeger »

I guess PYTHONPATH needs to be set so that Domoticz can find the virtual environment—for example, /home/pi/domoticz.env. I can't look up the exact command right now, but with the help of AI, it should be a piece of cake.
Stop, look and listen.
Pchatill
Posts: 36
Joined: Wednesday 16 September 2015 5:52
Target OS: Raspberry Pi / ODroid
Domoticz version: v2026.2
Location: France
Contact:

Re: Pydmodbus install with venv environment

Post by Pchatill »

Piece of cake ... For you ;) ;)
jannl
Posts: 870
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1.x
Location: Geleen
Contact:

Re: Pydmodbus install with venv environment

Post by jannl »

Pchatill wrote: Monday 27 July 2026 10:28 Thanks for reply Janni.
Do you use pymodbus for the Domoticz-solax-plugin?
I use it for solaredge
User avatar
imautohuttraeger
Posts: 393
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Germany
Contact:

Re: Pydmodbus install with venv environment

Post by imautohuttraeger »

Piece of cake ... For you ;) ;)
I see 😉. I can only type on a smartphone right now
, but I hope everything is correct.

1.
Open Chat or or Gemini or Claude (preferred) in your browser.

2.
Copy and paste below textand send this text to the AI:

Code: Select all

I want PYTHONPATH to be set so that Domoticz can find the virtual environment. The path is 

/home/pi/Domoticz_Python_Environment

Please tell me the Linux commands that also ensure, that PYTHONPATH is also known on every reboot of the system or restart of Domoticz
3.
Follow the steps of the answer.
Last edited by imautohuttraeger on Monday 27 July 2026 11:36, edited 1 time in total.
Stop, look and listen.
User avatar
imautohuttraeger
Posts: 393
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Germany
Contact:

Re: Pydmodbus install with venv environment

Post by imautohuttraeger »

jannl wrote: Monday 27 July 2026 11:21
Pchatill wrote: Monday 27 July 2026 10:28 Thanks for reply Janni.
Do you use pymodbus for the Domoticz-solax-plugin?
I use it for solaredge
So you use it for a solaredge inverter already and now you additionally want to use it for a solax inverter as well?
Stop, look and listen.
jannl
Posts: 870
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1.x
Location: Geleen
Contact:

Re: Pydmodbus install with venv environment

Post by jannl »

No I don't, the question was about pymodbus. 3.6.9 is compatible with the new python in Domoticz docker.
User avatar
imautohuttraeger
Posts: 393
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Germany
Contact:

Re: Pydmodbus install with venv environment

Post by imautohuttraeger »

jannl wrote: Monday 27 July 2026 11:37 No I don't, the question was about pymodbus. 3.6.9 is compatible with the new python in Domoticz docker.
Ah - my fault. I was reading with too less attention.
Stop, look and listen.
Pchatill
Posts: 36
Joined: Wednesday 16 September 2015 5:52
Target OS: Raspberry Pi / ODroid
Domoticz version: v2026.2
Location: France
Contact:

Re: Pydmodbus install with venv environment

Post by Pchatill »

Thanks a lot for your answers. Thanks also to Claude ...
I will try again since beginning.
I will inform you in few days.
Patrick
User avatar
imautohuttraeger
Posts: 393
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Germany
Contact:

Re: Pydmodbus install with venv environment

Post by imautohuttraeger »

You can even ask Claude to do this:

Code: Select all

I want to install this Plugin

https://github.com/saidlm/Domoticz-Solax-plugin

Please guide me throw all the steps that I needed including the whole environment.
Claude will then lead you step by step including Explanations and maybe some detail questions
Stop, look and listen.
Pchatill
Posts: 36
Joined: Wednesday 16 September 2015 5:52
Target OS: Raspberry Pi / ODroid
Domoticz version: v2026.2
Location: France
Contact:

Re: Pydmodbus install with venv environment: SOLVED

Post by Pchatill »

Thanks a lot imautohuttraeger !!
And thanks a lot Claude!
Claude solved my problem and also re-write the pluging to be compatible with my inverter.
That's my first experience with IA!
That's stunning!
User avatar
imautohuttraeger
Posts: 393
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Germany
Contact:

Re: Pydmodbus install with venv environment: SOLVED

Post by imautohuttraeger »

Pchatill wrote: Thursday 30 July 2026 20:32 Thanks a lot imautohuttraeger !!
And thanks a lot Claude!
👍👍👍
Stop, look and listen.
Post Reply