import pip3 module Topic is solved

Python and python framework

Moderator: leecollings

Post Reply
appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

import pip3 module

Post by appelflap »

Hi,

I'm building a domoticz python plugin for a MillHeat WiFi heater: https://github.com/appelflap/domoticz-millheat
And it needs this code as a connector to the heater: https://github.com/Danielhiversen/pymill

I've installed the needed code through pip3 (package name `millheater`), but domoticz keeps saying it can't find it. I've also made a fake Domoticz and the status fetching functions of the plugin are working properly outside of Domoticz.

Code: Select all

2018-11-26 09:58:57.095 Error: (MillHeat) failed to load 'plugin.py', Python Path used was '/home/appelflap/domoticz/plugins/millheat/:/usr/lib/python36.zip:/usr/lib/python3.6:/usr/lib/python3.6:/usr/lib/python3.6/lib-dynload'.
2018-11-26 09:58:57.095 Error: (MillHeat) Module Import failed, exception: 'ModuleNotFoundError'
2018-11-26 09:58:57.095 Error: (MillHeat) Module Import failed: ' Name: mill'
2018-11-26 09:58:57.095 Error: (MillHeat) Error Line details not available.
I'm not going to sudo copy the pip packages from my local store `.local/lib/python3.6/site-packages/` to `/usr/lib/python3.6`.
What would be the cleanest way to add the local store the python search path in Domoticz so its all userspace?

This is my latest attempt.. It works (ubuntu) but I don't think its very portable :roll:

Code: Select all

import getpass

# Add pip3 locations
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.6/dist-packages')
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.6/site-packages')
sys.path.append('/usr/lib/python3/dist-packages')
import mill
appelflap
Posts: 19
Joined: Friday 14 March 2014 22:12
Target OS: Linux
Domoticz version: beta
Contact:

Re: import pip3 module

Post by appelflap »

Ok, 'fixed it' for now by adding more paths..

Code: Select all

import sys
import getpass

# Add pip3 locations
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.5/site-packages')
sys.path.append('/home/'+getpass.getuser()+'/.local/lib/python3.6/site-packages')
sys.path.append('/usr/local/lib/python3.5/dist-packages')
sys.path.append('/usr/local/lib/python3.6/dist-packages')
sys.path.append('/usr/lib/python3/dist-packages')
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest