moroen / IKEA-Tradfri-plugin

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

PIP3 installation error #86

Closed SANCLA closed 4 years ago

SANCLA commented 4 years ago

Hi there developers!

I have a questions and a request to spend a little bit of time to this great plugin for Domoticz. It seems that the installation instructions do no longer apply for the latest raspbians.

I just did a clean install of Raspbian with a update and upgrade cycle. After this, I installed the regular Domoticz setup with the curl script, all went OK. But when trying to install this plugin, I receive an error with PIP3, command not found.

Are you able to reproduce this error and would you be so kind to provide a new set of instructions that are compatible with current installations? How can I help?

moroen commented 4 years ago

Just to make sure, you'r on the latest buster image? Result of:

$ uname -r
$ python3 --version
moroen commented 4 years ago

On a fresh (not upgraded) Buster image, it's recommended to switch to the new pycoap version, found in the pycoap branch. The updated instructions in the readme-pi.md file works. I noticed one problem with pip3, it failed after trying to update pip itself...

Solved it by reinstalling the python3-pip package

$ sudo apt remove python3-pip
$ sudo apt install python3-pip
$ sudo -H pip3 install -U pip
SANCLA commented 4 years ago

Hi Moroen,

Sorry for late reply just now, it's the holidays (deadlines, ho-ho-ho). I'm a bit confused here.

Yes I do use the latest Buster image, updated and upgraded to the latest standards.

I am trying the following steps, based on a clean install I just documented on my site (mainly for reference but others can enjoy these to): http://www.sancla.com/news/raspberry-pi-4-with-domoticz/

After this 'clean install', I follow the following steps:

Step 1: cd domoticz/plugins/ git clone --branch pycoap https://github.com/moroen/IKEA-Tradfri-plugin.git IKEA-Tradfri cd IKEA-Tradfri

Step 2: sudo apt install python3 python3-dev python3-pip golang -y sudo -H pip3 install --upgrade pip sudo -H pip3 install --upgrade setuptools sudo -H pip3 install -r requirements-pi.txt

Step 3: python3 tradfricoap.py config IP KEY

This last command trows me an error:

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfricoap.py config 10.1.2.14 ***** Traceback (most recent call last): File "tradfricoap.py", line 11, in import pycoap File "/usr/local/lib/python3.7/dist-packages/pycoap/init.py", line 1, in from .pycoap import Request, setDebugLevel, GET, PUT, POST File "/usr/local/lib/python3.7/dist-packages/pycoap/pycoap.py", line 1, in import _pycoap ImportError: dynamic module does not define module export function (PyInit__pycoap)

However, as I have been playing a bit with this run, it's not a full clean install. Next following days, if time permits, i'll do a clean install and clean run using above instructions. I'll let you know about the outcome...

SANCLA commented 4 years ago

uname -r = 4.19.75-v71+ python3 --version = Python 3.7.3

moroen commented 4 years ago

Strange, I'm starting to believe I've done something when trying this on one of my Pies, but I'm unable to figure it out... Anyway, please try to install pycoap manually, just follow the instructions in the readme. You'll findt it here: https://github.com/moroen/pycoap

This should give some more information on what's going on if manuall install also fails. Feel free to report here, or open a issue for the pycoap repo if installing manually fails!

Regards, M

meneerbroekhuis commented 4 years ago

I did the manual install of the pycoap as Moroen mentioned here above. Unfortunately the result is the same error when trying to configure and test the connection in step 6 of this how-to (https://github.com/moroen/IKEA-Tradfri-plugin/blob/pycoap/README-PI.md)

golang (2:1.11~1+b6) python3 (3.7.3-1) python3-dev (3.7.3-1) python3-pip (18.1-5+rptl)

Traceback (most recent call last): File "tradfricoap.py", line 11, in import pycoap File "/usr/local/lib/python3.7/dist-packages/pycoap/init.py", line 1, in from .pycoap import Request, setDebugLevel, GET, PUT, POST File "/usr/local/lib/python3.7/dist-packages/pycoap/pycoap.py", line 1, in import _pycoap ImportError: dynamic module does not define module export function (PyInit__pycoap)

meneerbroekhuis commented 4 years ago

And this is the output from the "git clone" command in the pycoap installation how-to:

pi@raspberrypi:~ $ git clone https://github.com/moroen/pycoap.git Cloning into 'pycoap'... remote: Enumerating objects: 145, done. remote: Counting objects: 100% (145/145), done. remote: Compressing objects: 100% (84/84), done. remote: Total 293 (delta 72), reused 110 (delta 54), pack-reused 148 Receiving objects: 100% (293/293), 1.78 MiB | 3.01 MiB/s, done. Resolving deltas: 100% (141/141), done. pi@raspberrypi:~ $ cd pycoap pi@raspberrypi:~/pycoap $ sudo python3 setup.py install running install running bdist_egg running egg_info creating pycoap.egg-info writing pycoap.egg-info/PKG-INFO writing dependency_links to pycoap.egg-info/dependency_links.txt writing top-level names to pycoap.egg-info/top_level.txt writing manifest file 'pycoap.egg-info/SOURCES.txt' reading manifest file 'pycoap.egg-info/SOURCES.txt' writing manifest file 'pycoap.egg-info/SOURCES.txt' installing library code to build/bdist.linux-armv7l/egg running install_lib running build_py creating build creating build/lib.linux-armv7l-3.7 creating build/lib.linux-armv7l-3.7/pycoap copying pycoap/pycoap.py -> build/lib.linux-armv7l-3.7/pycoap copying pycoap/init.py -> build/lib.linux-armv7l-3.7/pycoap running build_ext $ GOPATH=/tmp/tmpe84jwxpm go get -d /usr/bin/ld: /tmp/ccS1QOQI.o: in function main': test.c:(.text+0xc): undefined reference tof' collect2: error: ld returned 1 exit status $ CGO_CFLAGS=-I/usr/include/python3.7m CGO_LDFLAGS=-Wl,--unresolved-symbols=igno re-all GOPATH=/tmp/tmpe84jwxpm go build -buildmode=c-shared -o /home/pi/pycoap/b uild/lib.linux-armv7l-3.7/_pycoap.cpython-37m-arm-linux-gnueabihf.so creating build/bdist.linux-armv7l creating build/bdist.linux-armv7l/egg copying build/lib.linux-armv7l-3.7/_pycoap.cpython-37m-arm-linux-gnueabihf.so -> build/bdist.linux-armv7l/egg creating build/bdist.linux-armv7l/egg/pycoap copying build/lib.linux-armv7l-3.7/pycoap/pycoap.py -> build/bdist.linux-armv7l/egg/pycoap copying build/lib.linux-armv7l-3.7/pycoap/init.py -> build/bdist.linux-armv7l/egg/pycoap copying build/lib.linux-armv7l-3.7/_pycoap.cpython-37m-arm-linux-gnueabihf.h -> build/bdist.linux-armv7l/egg byte-compiling build/bdist.linux-armv7l/egg/pycoap/pycoap.py to pycoap.cpython-37.pyc byte-compiling build/bdist.linux-armv7l/egg/pycoap/init.py to init.cpython-37.pyc creating stub loader for _pycoap.cpython-37m-arm-linux-gnueabihf.so byte-compiling build/bdist.linux-armv7l/egg/_pycoap.py to _pycoap.cpython-37.pyc creating build/bdist.linux-armv7l/egg/EGG-INFO copying pycoap.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO copying pycoap.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO copying pycoap.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO copying pycoap.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO writing build/bdist.linux-armv7l/egg/EGG-INFO/native_libs.txt zip_safe flag not set; analyzing archive contents... pycache._pycoap.cpython-37: module references file creating dist creating 'dist/pycoap-0.5.3-py3.7-linux-armv7l.egg' and adding 'build/bdist.linux-armv7l/egg' to it removing 'build/bdist.linux-armv7l/egg' (and everything under it) Processing pycoap-0.5.3-py3.7-linux-armv7l.egg creating /usr/local/lib/python3.7/dist-packages/pycoap-0.5.3-py3.7-linux-armv7l.egg Extracting pycoap-0.5.3-py3.7-linux-armv7l.egg to /usr/local/lib/python3.7/dist-packages Adding pycoap 0.5.3 to easy-install.pth file

Installed /usr/local/lib/python3.7/dist-packages/pycoap-0.5.3-py3.7-linux-armv7l.egg Processing dependencies for pycoap==0.5.3 Finished processing dependencies for pycoap==0.5.3

moroen commented 4 years ago

That looks correct, what happens when you try running python3 tradfricoap.py config IP KEY in the IKEA-Tradfri plugin directory now?

meneerbroekhuis commented 4 years ago

Same error as before...

pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfricoap.py config IP KEY (i filled in my own IP and KEY offcourse) Traceback (most recent call last): File "tradfricoap.py", line 11, in import pycoap File "/usr/local/lib/python3.7/dist-packages/pycoap/init.py", line 1, in from .pycoap import Request, setDebugLevel, GET, PUT, POST File "/usr/local/lib/python3.7/dist-packages/pycoap/pycoap.py", line 1, in import _pycoap ImportError: dynamic module does not define module export function (PyInit__pycoap)

moroen commented 4 years ago

This puzzles me to no end... Just started with a fresh image of Raspbian Buster Lite, version September 2019, and after a sudo apt update; sudo apt upgrade, followed the steps for raspberry pi, and python3 tradfricoap.py config XX XX works as expected. The only thing I did before starting the installation, was using raspi-config to set the locale to nb-NO.UTF-8 and norwegian keyboard layout, and enabled the SSH server... This is on a Raspberry Pi 3 model B v1.2...

moroen commented 4 years ago

Just for fun, I tried to uninstall pycoap and installing it manually using setup.py, and it still works...

meneerbroekhuis commented 4 years ago

I’ll have a go tomorrow As soon as i can. Clean install of everything and then hope for the best👍..

meneerbroekhuis commented 4 years ago

So i did a complete rebuild of my pi3. Installed fresh domoticz -- succes Installed pycoap using setup.py ---- succes then follewed these steps https://github.com/moroen/IKEA-Tradfri-plugin/blob/pycoap/README-PI.md up to step 6.........

And the i got this error: _pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ python3 tradfricoap.py config 192.168.2.18 XXXXEMGXmfpervLB CRITICAL:root:Createident: No data from gateway

So stuck again. I ran the "python3 tradfricoap.py list" command just for the sake of it and i got this back: INFO:tradfri.config:Loading config INFO:root:Config created CRITICAL:root:Gateway not specified CRITICAL:root:Unable to get list of devices

And that is it so far.....

meneerbroekhuis commented 4 years ago

Sorry.. made a mistake in the IP-adress😁.. it works like a charm now! 7422E941-8996-45FE-A5EC-38562B79CB83

moroen commented 4 years ago

Nice! :)

And the plugin works in Domoticz as well?

meneerbroekhuis commented 4 years ago

Didnt have any time left.. got the nightshift so i will try tomorrow. Thanks so far👍

meneerbroekhuis commented 4 years ago

Yes! Everything now works great. Tradfri Hardware shows up in Domoticz and so do the devices. And the work perfectly! Thanks Moroen for your help and offcourse with this great plugin!

SANCLA commented 4 years ago

Just tested it with the latest update of the https://github.com/moroen/IKEA-Tradfri-plugin/blob/pycoap/README-PI.md file. Works fantastic, thanks moroen!!