moroen / IKEA-Tradfri-plugin

A Python plugin for Domoticz to controll IKEA Gateway
68 stars 23 forks source link

Module 'py3coap' not found #100

Closed berties14 closed 4 years ago

berties14 commented 4 years ago

I have followed the instructions under 3. Installing an API for coap requests, and the command: pip3 install py3coap didn't return any error. I set the plugin for pycoap by the command: python3 plugin.py api pycoap which also gave no error. Then the command: python3 plugin.py config IP KEY with correct IP and KEY also gave no error. Finally, python3 plugin.py list gave the correct list of all devices and status of the gateway. However, the hardware does not show up under domoticz and the log gives the following errors:

2020-03-08 15:16:08.438 Error: (Ikea) Failed to initialize tradfri module.
2020-03-08 15:16:08.438 Error: (Ikea) Module 'py3coap' not found.

How come the commandline works fine, and in the domoticz the plugin cannot be found?

moroen commented 4 years ago

This is a common error if you have more than one version of python installed. The version of python used when on the command line (and thus where py3coap is installed and working) is not the same as the version used by domoticz...

On domotiz startup, take note of the python version that domoticz is using: 2020-03-08 21:18:20.112 Status: PluginSystem: Started, Python version '3.7.5'. And check the version from the command line and make sure that it's the same...

berties14 commented 4 years ago

Indeed, domoticz started python 3.8: 2020-03-08 22:08:18.488 Status: PluginSystem: Started, Python version '3.8.0'. and the pip was running on python 3.6. I therefore forced install of py3coap through python 3.8 by: python3.8 -m pip install py3coap. Now every is working!