Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Error while installing #28

Closed
VolkerSchlegel opened this issue Jul 12, 2020 · 22 comments
Closed

Error while installing #28

VolkerSchlegel opened this issue Jul 12, 2020 · 22 comments

Comments

@VolkerSchlegel
Copy link

VolkerSchlegel commented Jul 12, 2020

I tried to install it using pip, but I got the following error:

pi@raspberrypi:~ $ pip install python-lirc
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python-lirc
  Using cached python-lirc-1.2.3.tar.gz (36 kB)
Using legacy setup.py install for python-lirc, since package 'wheel' is not installed.
Installing collected packages: python-lirc
    Running setup.py install for python-lirc ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nTATVo/python-lirc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nTATVo/python-lirc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-Pik2vj/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/pi/.local/include/python2.7/python-lirc
         cwd: /tmp/pip-install-nTATVo/python-lirc/
    Complete output (13 lines):
    running install
    running build
    running build_ext
    building 'lirc' extension
    creating build
    creating build/temp.linux-armv7l-2.7
    creating build/temp.linux-armv7l-2.7/lirc
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-InigCj/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/lirc/ -I/usr/include/python2.7 -c lirc/lirc.c -o build/temp.linux-armv7l-2.7/lirc/lirc.o
    lirc/lirc.c:276:10: fatal error: lirc/lirc_client.h: Datei oder Verzeichnis nicht gefunden
     #include "lirc/lirc_client.h"
              ^~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-nTATVo/python-lirc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-nTATVo/python-lirc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-Pik2vj/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/pi/.local/include/python2.7/python-lirc Check the logs for full command output.
@tompreston
Copy link
Owner

Hey, I updated your code tags, you should use three backticks for code blocks.

You have two errors:

  1. Python 2 has reached end of life, use Python 3 (pip3)
  2. Looks like it can't find lirc/lirc_client.h, try installing liblircclient-dev

@VolkerSchlegel
Copy link
Author

I know, that python 2 has reached the end of live, but sadly the script I want to run is still written in python 2... I sucessfullly installed liblircclient-dev but it still doesnt work..
Here is the error(in code blocks this time):

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python-lirc
  Using cached python-lirc-1.2.3.tar.gz (36 kB)
Building wheels for collected packages: python-lirc
  Building wheel for python-lirc (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d9ubht_5/python-lirc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d9ubht_5/python-lirc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3sf_nu4y
       cwd: /tmp/pip-install-d9ubht_5/python-lirc/
  Complete output (97 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'lirc' extension
  creating build
  creating build/temp.linux-armv7l-3.7
  creating build/temp.linux-armv7l-3.7/lirc
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/lirc/ -I/usr/include/python3.7m -c lirc/lirc.c -o build/temp.linux-armv7l-3.7/lirc/lirc.o
  lirc/lirc.c: In function '__Pyx__ExceptionSave':
  lirc/lirc.c:5050:21: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
       *type = tstate->exc_type;
                       ^~~~~~~~
                       curexc_type
  lirc/lirc.c:5051:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
       *value = tstate->exc_value;
                        ^~~~~~~~~
                        curexc_value
  lirc/lirc.c:5052:19: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
       *tb = tstate->exc_traceback;
                     ^~~~~~~~~~~~~
                     curexc_traceback
  lirc/lirc.c: In function '__Pyx__ExceptionReset':
  lirc/lirc.c:5059:24: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  lirc/lirc.c:5060:25: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  lirc/lirc.c:5061:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  lirc/lirc.c:5062:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
       tstate->exc_type = type;
               ^~~~~~~~
               curexc_type
  lirc/lirc.c:5063:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
       tstate->exc_value = value;
               ^~~~~~~~~
               curexc_value
  lirc/lirc.c:5064:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
       tstate->exc_traceback = tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  lirc/lirc.c: In function '__Pyx__GetException':
  lirc/lirc.c:5119:24: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  lirc/lirc.c:5120:25: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  lirc/lirc.c:5121:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  lirc/lirc.c:5122:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
       tstate->exc_type = local_type;
               ^~~~~~~~
               curexc_type
  lirc/lirc.c:5123:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
       tstate->exc_value = local_value;
               ^~~~~~~~~
               curexc_value
  lirc/lirc.c:5124:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
       tstate->exc_traceback = local_tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  lirc/lirc.c: In function '__Pyx__ExceptionSwap':
  lirc/lirc.c:5146:24: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  lirc/lirc.c:5147:25: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  lirc/lirc.c:5148:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  lirc/lirc.c:5149:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
       tstate->exc_type = *type;
               ^~~~~~~~
               curexc_type
  lirc/lirc.c:5150:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
       tstate->exc_value = *value;
               ^~~~~~~~~
               curexc_value
  lirc/lirc.c:5151:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
       tstate->exc_traceback = *tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for python-lirc
  Running setup.py clean for python-lirc
Failed to build python-lirc
Installing collected packages: python-lirc
    Running setup.py install for python-lirc ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d9ubht_5/python-lirc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d9ubht_5/python-lirc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-4yu2u8k8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/python-lirc
         cwd: /tmp/pip-install-d9ubht_5/python-lirc/
    Complete output (97 lines):
    running install
    running build
    running build_ext
    building 'lirc' extension
    creating build
    creating build/temp.linux-armv7l-3.7
    creating build/temp.linux-armv7l-3.7/lirc
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/lirc/ -I/usr/include/python3.7m -c lirc/lirc.c -o build/temp.linux-armv7l-3.7/lirc/lirc.o
    lirc/lirc.c: In function '__Pyx__ExceptionSave':
    lirc/lirc.c:5050:21: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
         *type = tstate->exc_type;
                         ^~~~~~~~
                         curexc_type
    lirc/lirc.c:5051:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
         *value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
    lirc/lirc.c:5052:19: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
         *tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
    lirc/lirc.c: In function '__Pyx__ExceptionReset':
    lirc/lirc.c:5059:24: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
         tmp_type = tstate->exc_type;
                            ^~~~~~~~
                            curexc_type
    lirc/lirc.c:5060:25: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
         tmp_value = tstate->exc_value;
                             ^~~~~~~~~
                             curexc_value
    lirc/lirc.c:5061:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
         tmp_tb = tstate->exc_traceback;
                          ^~~~~~~~~~~~~
                          curexc_traceback
    lirc/lirc.c:5062:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
         tstate->exc_type = type;
                 ^~~~~~~~
                 curexc_type
    lirc/lirc.c:5063:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
         tstate->exc_value = value;
                 ^~~~~~~~~
                 curexc_value
    lirc/lirc.c:5064:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
         tstate->exc_traceback = tb;
                 ^~~~~~~~~~~~~
                 curexc_traceback
    lirc/lirc.c: In function '__Pyx__GetException':
    lirc/lirc.c:5119:24: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
         tmp_type = tstate->exc_type;
                            ^~~~~~~~
                            curexc_type
    lirc/lirc.c:5120:25: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
         tmp_value = tstate->exc_value;
                             ^~~~~~~~~
                             curexc_value
    lirc/lirc.c:5121:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
         tmp_tb = tstate->exc_traceback;
                          ^~~~~~~~~~~~~
                          curexc_traceback
    lirc/lirc.c:5122:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
         tstate->exc_type = local_type;
                 ^~~~~~~~
                 curexc_type
    lirc/lirc.c:5123:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
         tstate->exc_value = local_value;
                 ^~~~~~~~~
                 curexc_value
    lirc/lirc.c:5124:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
         tstate->exc_traceback = local_tb;
                 ^~~~~~~~~~~~~
                 curexc_traceback
    lirc/lirc.c: In function '__Pyx__ExceptionSwap':
    lirc/lirc.c:5146:24: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
         tmp_type = tstate->exc_type;
                            ^~~~~~~~
                            curexc_type
    lirc/lirc.c:5147:25: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
         tmp_value = tstate->exc_value;
                             ^~~~~~~~~
                             curexc_value
    lirc/lirc.c:5148:22: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
         tmp_tb = tstate->exc_traceback;
                          ^~~~~~~~~~~~~
                          curexc_traceback
    lirc/lirc.c:5149:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_type'; did you mean 'curexc_type'?
         tstate->exc_type = *type;
                 ^~~~~~~~
                 curexc_type
    lirc/lirc.c:5150:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_value'; did you mean 'curexc_value'?
         tstate->exc_value = *value;
                 ^~~~~~~~~
                 curexc_value
    lirc/lirc.c:5151:13: error: 'PyThreadState' {aka 'struct _ts'} has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
         tstate->exc_traceback = *tb;
                 ^~~~~~~~~~~~~
                 curexc_traceback
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d9ubht_5/python-lirc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d9ubht_5/python-lirc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-4yu2u8k8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/python-lirc Check the logs for full command output.

@ankithu
Copy link

ankithu commented Jul 19, 2020

I'm having the same problem even after following the above steps on a raspberry pi running Raspberry Pi OS using python 3.

@VolkerSchlegel
Copy link
Author

VolkerSchlegel commented Jul 20, 2020

I'm using a Raspberry Pi 3B+ with raspbian os 10 maybe that can somehow help you
@tompreston

@partofthething
Copy link

The has no member named 'exc_traceback'; did you mean 'curexc_traceback'? etc. errors are due to a cython that is out of date. The PyPI probably has c code generated by an outdated version of cython. A workaround that I just found that works on a Raspberry Pi 3 using Python 3.7 to work is to clone the repository source and build it yourself. This re-runs cython with modern cython which doesn't have those errors.

pip install cython
git clone https://github.com/tompreston/python-lirc.git
cd python-lirc/
python setup.py build
python setup.py install

gives ...

Processing dependencies for python-lirc==1.2.3
Finished processing dependencies for python-lirc==1.2.3

Yay we're back in business!

@VolkerSchlegel
Copy link
Author

VolkerSchlegel commented Sep 24, 2020

ok, I tried again some minutes ago, because I needed to reinstall raspbian a while ago and now I get another error:

pip3 install python-lirc
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python-lirc
  Using cached https://files.pythonhosted.org/packages/20/37/5614ed0459439a96430e1aac479b6608b51e69ca0bd7d91277517d5895e9/python-lirc-1.2.3.tar.gz
Building wheels for collected packages: python-lirc
  Running setup.py bdist_wheel for python-lirc ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p2s1l7wl/python-lirc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-9_3_7hbw --python-tag cp37:
  running bdist_wheel
  running build
  running build_ext
  building 'lirc' extension
  creating build
  creating build/temp.linux-armv7l-3.7
  creating build/temp.linux-armv7l-3.7/lirc
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/lirc/ -I/usr/include/python3.7m -c lirc/lirc.c -o build/temp.linux-armv7l-3.7/lirc/lirc.o
  lirc/lirc.c:276:10: fatal error: lirc/lirc_client.h: Datei oder Verzeichnis nicht gefunden
   #include "lirc/lirc_client.h"
            ^~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for python-lirc
  Running setup.py clean for python-lirc
Failed to build python-lirc
Installing collected packages: python-lirc
  Running setup.py install for python-lirc ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p2s1l7wl/python-lirc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-aj6aj4_w/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_ext
    building 'lirc' extension
    creating build
    creating build/temp.linux-armv7l-3.7
    creating build/temp.linux-armv7l-3.7/lirc
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/lirc/ -I/usr/include/python3.7m -c lirc/lirc.c -o build/temp.linux-armv7l-3.7/lirc/lirc.o
    lirc/lirc.c:276:10: fatal error: lirc/lirc_client.h: Datei oder Verzeichnis nicht gefunden
     #include "lirc/lirc_client.h"
              ^~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p2s1l7wl/python-lirc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-aj6aj4_w/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-p2s1l7wl/python-lirc/

I have no idea while the error message changed, but if this means one error less I'll take it 🤷‍♂️

@partofthething
Copy link

That gets back to this where the suggestion is:

try installing liblircclient-dev

So sudo apt install liblircclient-dev should do it.

@VolkerSchlegel
Copy link
Author

I installed liblircclient-dev, now this error is gone, but there is another one....

~ $ pip3 install python-lirc
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python-lirc
  Using cached https://files.pythonhosted.org/packages/20/37/5614ed0459439a96430e1aac479b6608b51e69ca0bd7d91277517d5895e9/python-lirc-1.2.3.tar.gz
Building wheels for collected packages: python-lirc
  Running setup.py bdist_wheel for python-lirc ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4nx6umps/python-lirc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-nca76hz1 --python-tag cp37:
  running bdist_wheel
  running build
  running build_ext
  building 'lirc' extension
  creating build
  creating build/temp.linux-armv7l-3.7
  creating build/temp.linux-armv7l-3.7/lirc
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/lirc/ -I/usr/include/python3.7m -c lirc/lirc.c -o build/temp.linux-armv7l-3.7/lirc/lirc.o
  lirc/lirc.c: In function ‘__Pyx__ExceptionSave’:
  lirc/lirc.c:5050:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       *type = tstate->exc_type;
                       ^~~~~~~~
                       curexc_type
  lirc/lirc.c:5051:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       *value = tstate->exc_value;
                        ^~~~~~~~~
                        curexc_value
  lirc/lirc.c:5052:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       *tb = tstate->exc_traceback;
                     ^~~~~~~~~~~~~
                     curexc_traceback
  lirc/lirc.c: In function ‘__Pyx__ExceptionReset’:
  lirc/lirc.c:5059:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  lirc/lirc.c:5060:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  lirc/lirc.c:5061:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  lirc/lirc.c:5062:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tstate->exc_type = type;
               ^~~~~~~~
               curexc_type
  lirc/lirc.c:5063:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tstate->exc_value = value;
               ^~~~~~~~~
               curexc_value
  lirc/lirc.c:5064:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tstate->exc_traceback = tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  lirc/lirc.c: In function ‘__Pyx__GetException’:
  lirc/lirc.c:5119:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  lirc/lirc.c:5120:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  lirc/lirc.c:5121:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  lirc/lirc.c:5122:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tstate->exc_type = local_type;
               ^~~~~~~~
               curexc_type
  lirc/lirc.c:5123:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tstate->exc_value = local_value;
               ^~~~~~~~~
               curexc_value
  lirc/lirc.c:5124:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tstate->exc_traceback = local_tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  lirc/lirc.c: In function ‘__Pyx__ExceptionSwap’:
  lirc/lirc.c:5146:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  lirc/lirc.c:5147:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  lirc/lirc.c:5148:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  lirc/lirc.c:5149:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tstate->exc_type = *type;
               ^~~~~~~~
               curexc_type
  lirc/lirc.c:5150:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tstate->exc_value = *value;
               ^~~~~~~~~
               curexc_value
  lirc/lirc.c:5151:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tstate->exc_traceback = *tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for python-lirc
  Running setup.py clean for python-lirc
Failed to build python-lirc
Installing collected packages: python-lirc
  Running setup.py install for python-lirc ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4nx6umps/python-lirc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-2jhve9of/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_ext
    building 'lirc' extension
    creating build
    creating build/temp.linux-armv7l-3.7
    creating build/temp.linux-armv7l-3.7/lirc
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/lirc/ -I/usr/include/python3.7m -c lirc/lirc.c -o build/temp.linux-armv7l-3.7/lirc/lirc.o
    lirc/lirc.c: In function ‘__Pyx__ExceptionSave’:
    lirc/lirc.c:5050:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
         *type = tstate->exc_type;
                         ^~~~~~~~
                         curexc_type
    lirc/lirc.c:5051:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
         *value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
    lirc/lirc.c:5052:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         *tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
    lirc/lirc.c: In function ‘__Pyx__ExceptionReset’:
    lirc/lirc.c:5059:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
         tmp_type = tstate->exc_type;
                            ^~~~~~~~
                            curexc_type
    lirc/lirc.c:5060:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
         tmp_value = tstate->exc_value;
                             ^~~~~~~~~
                             curexc_value
    lirc/lirc.c:5061:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         tmp_tb = tstate->exc_traceback;
                          ^~~~~~~~~~~~~
                          curexc_traceback
    lirc/lirc.c:5062:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
         tstate->exc_type = type;
                 ^~~~~~~~
                 curexc_type
    lirc/lirc.c:5063:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
         tstate->exc_value = value;
                 ^~~~~~~~~
                 curexc_value
    lirc/lirc.c:5064:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         tstate->exc_traceback = tb;
                 ^~~~~~~~~~~~~
                 curexc_traceback
    lirc/lirc.c: In function ‘__Pyx__GetException’:
    lirc/lirc.c:5119:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
         tmp_type = tstate->exc_type;
                            ^~~~~~~~
                            curexc_type
    lirc/lirc.c:5120:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
         tmp_value = tstate->exc_value;
                             ^~~~~~~~~
                             curexc_value
    lirc/lirc.c:5121:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         tmp_tb = tstate->exc_traceback;
                          ^~~~~~~~~~~~~
                          curexc_traceback
    lirc/lirc.c:5122:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
         tstate->exc_type = local_type;
                 ^~~~~~~~
                 curexc_type
    lirc/lirc.c:5123:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
         tstate->exc_value = local_value;
                 ^~~~~~~~~
                 curexc_value
    lirc/lirc.c:5124:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         tstate->exc_traceback = local_tb;
                 ^~~~~~~~~~~~~
                 curexc_traceback
    lirc/lirc.c: In function ‘__Pyx__ExceptionSwap’:
    lirc/lirc.c:5146:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
         tmp_type = tstate->exc_type;
                            ^~~~~~~~
                            curexc_type
    lirc/lirc.c:5147:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
         tmp_value = tstate->exc_value;
                             ^~~~~~~~~
                             curexc_value
    lirc/lirc.c:5148:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         tmp_tb = tstate->exc_traceback;
                          ^~~~~~~~~~~~~
                          curexc_traceback
    lirc/lirc.c:5149:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
         tstate->exc_type = *type;
                 ^~~~~~~~
                 curexc_type
    lirc/lirc.c:5150:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
         tstate->exc_value = *value;
                 ^~~~~~~~~
                 curexc_value
    lirc/lirc.c:5151:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
         tstate->exc_traceback = *tb;
                 ^~~~~~~~~~~~~
                 curexc_traceback
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-4nx6umps/python-lirc/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-2jhve9of/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-4nx6umps/python-lirc/

@partofthething
Copy link

partofthething commented Sep 25, 2020

We fixed that error above in the comment thread by cloning the source from github and building manually rather than using pip because the pip/PyPI version of python-lirc has out of date cython code that doesn't work on Python 3.7. Don't use pip3 install python-lirc, use the python setup.py build, etc. lines in the linked comment. Switch python out for python3 in your case if you're not in a virtual environment or whatever.

@VolkerSchlegel
Copy link
Author

ok, I'll try that

@VolkerSchlegel
Copy link
Author

Building went fine, but I got an error on installing:

running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/test-easy-install-3414.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/local/lib/python3.7/dist-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.

@partofthething
Copy link

try running with super-user permissions on the setup line: sudo python3 setup.py install

@VolkerSchlegel
Copy link
Author

pi@raspberrypi:~/python-lirc $ sudo python setup.py install
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    from Cython.Build import cythonize
ModuleNotFoundError: No module named 'Cython'
pi@raspberrypi:~/python-lirc $ 

(python refers to Python 3.7 for me)

@partofthething
Copy link

Sounds like you need cython. Run sudo apt install python3-cython or sudo python -m pip install cython or similar.

@VolkerSchlegel
Copy link
Author

ok, sudo python -m pip install cython worked, I'll try again now 🙂

@VolkerSchlegel
Copy link
Author

Ok, worked, nice 🙂
Thanks @partofthething and @tompreston 👍
Maybe try now again and look if you have cpython installed @ankithu

@VolkerSchlegel
Copy link
Author

By the way I would highly recommend updating the pip build 😉

@tompreston
Copy link
Owner

tompreston commented Oct 19, 2020

Nice work figuring it out.

I've been taking a look at this over the last few days, and trying to figure out how best to update it. Since Linux 4.18, IR is now handled in-kernel and IR events appear just like keyboard or mouse events, making the LIRC daemon and clients (like python-lirc) mostly redundant. The new way to configure keymaps is using ir-keytable which comes with v4l-utils.

I found the following links useful:

You can test this by running ir-keytable in test-mode and listening to all protocols:

ir-keytable -v -p all -t

You should see some output if you press buttons on your remote.

If you want to see some events you can find a keymap which matches your remote controller, then clear and write them to the rc device:

~$ ls /usr/lib/udev/rc_keymaps/*.toml
~$ sudo ir-keytable -c -w /usr/lib/udev/rc_keymaps/hauppauge.toml
~$ sudo libinput debug-events

If you don't have a remote controller, you can fake one with the rc-loopback kernel module, and inject the scancode which matches the KEY_VOLUMEUP key from hauppage.toml keymap.

~$ sudo modprobe rc-loopback
~$ sudo ir-ctl -K KEY_VOLUMEUP -k /lib/udev/rc_keymaps/hauppauge.toml

And finally you can monitor input events from Python using python-evdev, check out the tutorial. I had this printing IR events from the rc-loopback, please can someone try with an actual remote controller?

I suggest we take the following actions:

  1. Someone verify that real controllers are actually handled in-kernel.
  2. I will update the readme with the text from this comment.
  3. We archive this repo (a number of people come here trying to do "IR in Python") and remove python-lirc from PyPI.

What do you think? @Kakiking @partofthething @ankithu @thijstriemstra

Edit: couple of things I still need to investigate:

  • Does this work on raspberry pi? (Target audience)
  • Who relies on python-lirc? Will they be affected if we remove it from PyPI?

@nebhead
Copy link

nebhead commented Oct 23, 2020

This thread has helped me immensely. Thank you so much!

@GeorgeIoak
Copy link

@tompreston I working on anew project and came across this library but I faced installation troubles like others have. When I tried to build from source I ran across a different error from others because of a missing lirc header file:

volumio@volumio:~/src/python-lirc$ sudo python3 setup.py build
running build
running build_ext
building 'lirc' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/lirc/ -I/usr/include/python3.4m -c lirc/lirc.c -o build/temp.linux-armv7l-3.4/lirc/lirc.o
lirc/lirc.c:636:37: fatal error: lirc/include/media/lirc.h: No such file or directory
 #include "lirc/include/media/lirc.h"
                                     ^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

On one system I experimented by downloaded the lirc source and building and installing which worked but was a royal pain to get everything installed.

Reading your latest notes I decided to try ir-keytables and found that it did work and following the examples for Python using evdev also seemed to work. I only tested using the Pi as an IR receiver but I can confirm that it does work so I may tend to agree with you that this project might not be the best solution although it did work for me in the past.

@tompreston
Copy link
Owner

@GeorgeIoak that's great news, thank you for testing! I will update the README.md.

@tompreston
Copy link
Owner

I'm going to close this then.

Solutions:

  • The easiest solution is to just not use python-lirc (or LIRC) at all! Use python-evdev instead.
  • If you want to build, make sure you have the dependencies listed in the readme installed.
  • When installing with pip or setup.py, it defaults to a system-wide installation which requires root privilleges (sudo). Try with --user instead, eg python setup.py install --user

Thanks for contributing everyone, even if it does mean the demise of this project! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants