Trying to run two different Python versions with bookworm
Posted: Thursday 15 May 2025 18:43
Just switched to bookworm
I noticed an item was added to
sudo nano /etc/init.d/domoticz.sh, the startup file
export PYTHONPATH=/home/hjz/domoticz/Domoticz_Python_Environment:$PYTHONPATH
To add a different version I downloaded the "pyenv" application and stated that 3.10 must be used for the plugin with the tapo
hjz@debian:~/domoticz/plugins/tapo$ pyenv versions
system
* 3.10.0 (set by /home/hjz/domoticz/plugins/tapo/.python-version)
3.10.0/envs/myenv
3.10.0/envs/tapo
myenv --> /home/hjz/.pyenv/versions/3.10.0/envs/myenv
tapo --> /home/hjz/.pyenv/versions/3.10.0/envs/tapo
But when I run the files
Tapo: (TapoP100) failed to load 'plugin.py', Python Path used was '/home/hjz/domoticz/plugins/tapo/:/home/hjz/domoticz/Domoticz_Python_Environment:/home/hjz/domoticz:/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2025-05-15 18:31:48.208 Error: Tapo: Traceback (most recent call last):
2025-05-15 18:31:48.208 Error: Tapo: File "/home/hjz/domoticz/plugins/tapo/plugin.py", line 35, in <module>
2025-05-15 18:31:48.208 Error: Tapo: raise Exception("Incompatible Python version. Please use Python 3.10.x.")
2025-05-15 18:31:48.208 Error: Tapo: Exception: Incompatible Python version. Please use Python 3.10.x.
What is going wrong? Is the PYTHONPATH overruling the path I set with pvenv?
I noticed an item was added to
sudo nano /etc/init.d/domoticz.sh, the startup file
export PYTHONPATH=/home/hjz/domoticz/Domoticz_Python_Environment:$PYTHONPATH
To add a different version I downloaded the "pyenv" application and stated that 3.10 must be used for the plugin with the tapo
hjz@debian:~/domoticz/plugins/tapo$ pyenv versions
system
* 3.10.0 (set by /home/hjz/domoticz/plugins/tapo/.python-version)
3.10.0/envs/myenv
3.10.0/envs/tapo
myenv --> /home/hjz/.pyenv/versions/3.10.0/envs/myenv
tapo --> /home/hjz/.pyenv/versions/3.10.0/envs/tapo
But when I run the files
Tapo: (TapoP100) failed to load 'plugin.py', Python Path used was '/home/hjz/domoticz/plugins/tapo/:/home/hjz/domoticz/Domoticz_Python_Environment:/home/hjz/domoticz:/usr/lib/python311.zip:/usr/lib/python3.11:/usr/lib/python3.11/lib-dynload:/usr/local/lib/python3.11/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.11/dist-packages'.
2025-05-15 18:31:48.208 Error: Tapo: Traceback (most recent call last):
2025-05-15 18:31:48.208 Error: Tapo: File "/home/hjz/domoticz/plugins/tapo/plugin.py", line 35, in <module>
2025-05-15 18:31:48.208 Error: Tapo: raise Exception("Incompatible Python version. Please use Python 3.10.x.")
2025-05-15 18:31:48.208 Error: Tapo: Exception: Incompatible Python version. Please use Python 3.10.x.
What is going wrong? Is the PYTHONPATH overruling the path I set with pvenv?