OpenXbox / xbox-smartglass-core-python

SmartGlass Core protocol python library
https://pypi.python.org/pypi/xbox-smartglass-core
MIT License
73 stars 13 forks source link

can't install #11

Closed mreassassin closed 5 years ago

mreassassin commented 5 years ago

i recently did a fresh install of raspbian to get rid of a bunch of permissions problems I was having. I got everything back up and running EXCEPT being able to turn my xbox off using homebridge and/or homeassistant. each time I try to install smartglass-core-python I get errors. I can't remember how I got it to work last time around? here's my log:

pi@raspberrypi:~ $ pip install xbox-smartglass-core Collecting xbox-smartglass-core Using cached https://files.pythonhosted.org/packages/13/c8/2ffce1ddabe5b73422c7c46e808e4b02dbbc9362d2ecd2aee2a65e6e30a5/xbox_smartglass_core-1.0.12-py2.py3-none-any.whl Collecting urwid==2.0.1 (from xbox-smartglass-core) Collecting xbox-webapi>=1.1.2 (from xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/2d/bf/aaf24cc78184393c5c2472e822c0e145b793e346a8085bee02e89a3428ba/xbox_webapi-1.1.7-py2.py3-none-any.whl Collecting construct==2.9.41 (from xbox-smartglass-core) Collecting aenum==2.1.2; python_version <= "3.5" (from xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/44/c4/7cda7e7e71e18ad999cb9d23f9969f818af1ed6be71d18db7963680b8320/aenum-2.1.2-py2-none-any.whl Collecting gevent==1.3.7 (from xbox-smartglass-core) Collecting appdirs==1.4.3 (from xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4cbdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl Collecting dpkt==1.9.1 (from xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/e1/0f/30a8462ed17092a5d61ea12e212e9ce3740f19f5f9f2431287410429d306/dpkt-1.9.1-py2-none-any.whl Collecting cryptography==2.3.1 (from xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/22/21/233e38f74188db94e8451ef6385754a98f3cad9b59bedf3a8e8b14988be4/cryptography-2.3.1.tar.gz Collecting requests (from xbox-webapi>=1.1.2->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/ff/17/5cbb026005115301a8fb2f9b0e3e8d32313142fe8b617070e7baad20554f/requests-2.20.1-py2.py3-none-any.whl Collecting demjson (from xbox-webapi>=1.1.2->xbox-smartglass-core) Collecting cffi>=1.11.5 (from gevent==1.3.7->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz Collecting greenlet>=0.4.14 (from gevent==1.3.7->xbox-smartglass-core) Collecting asn1crypto>=0.21.0 (from cryptography==2.3.1->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl Collecting idna>=2.1 (from cryptography==2.3.1->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl Collecting six>=1.4.1 (from cryptography==2.3.1->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl Collecting enum34 (from cryptography==2.3.1->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl Collecting ipaddress (from cryptography==2.3.1->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/fc/d0/7fc3a811e011d4b388be48a0e381db8d990042df54aa4ef4599a31d39853/ipaddress-1.0.22-py2.py3-none-any.whl Collecting urllib3<1.25,>=1.21.1 (from requests->xbox-webapi>=1.1.2->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl Collecting chardet<3.1.0,>=3.0.2 (from requests->xbox-webapi>=1.1.2->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl Collecting certifi>=2017.4.17 (from requests->xbox-webapi>=1.1.2->xbox-smartglass-core) Using cached https://files.pythonhosted.org/packages/56/9d/1d02dd80bc4cd955f98980f28c5ee2200e1209292d5f9e9cc8d030d18655/certifi-2018.10.15-py2.py3-none-any.whl Collecting pycparser (from cffi>=1.11.5->gevent==1.3.7->xbox-smartglass-core) Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.19-py2.py3-none-any.whl Building wheels for collected packages: cryptography, cffi Running setup.py bdist_wheel for cryptography ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-sE3Q5U/cryptography/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/tmpTNT_Ucpip-wheel- --python-tag cp27: Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

include

^ compilation terminated. Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-sE3Q5U/cryptography/setup.py", line 318, in **keywords_with_side_effects(sys.argv) File "/usr/lib/python2.7/distutils/core.py", line 111, in setup _setup_distribution = dist = klass(attrs) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 317, in init self.fetch_build_eggs(attrs['setup_requires']) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 372, in fetch_build_eggs replace_conflicting=True, File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 846, in resolve dist = best[req.key] = env.best_match(req, ws, installer) File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1118, in best_match return self.obtain(req, installer) File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1130, in obtain return installer(requirement) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 440, in fetch_build_egg return cmd.easy_install(req) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 699, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 725, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 906, in install_eggs return self.build_and_install(setup_script, setup_base) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1145, in build_and_install self.run_setup(setup_script, setup_base, args) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1133, in run_setup raise DistutilsError("Setup script exited with %s" % (v.args[0],)) distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1


Failed building wheel for cryptography Running setup.py clean for cryptography Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-sE3Q5U/cryptography/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" clean --all: Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

include

               ^

compilation terminated. Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-sE3Q5U/cryptography/setup.py", line 318, in **keywords_with_side_effects(sys.argv) File "/usr/lib/python2.7/distutils/core.py", line 111, in setup _setup_distribution = dist = klass(attrs) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 317, in init self.fetch_build_eggs(attrs['setup_requires']) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 372, in fetch_build_eggs replace_conflicting=True, File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 846, in resolve dist = best[req.key] = env.best_match(req, ws, installer) File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1118, in best_match return self.obtain(req, installer) File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1130, in obtain return installer(requirement) File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 440, in fetch_build_egg return cmd.easy_install(req) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 699, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 725, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 906, in install_eggs return self.build_and_install(setup_script, setup_base) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1145, in build_and_install self.run_setup(setup_script, setup_base, args) File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1133, in run_setup raise DistutilsError("Setup script exited with %s" % (v.args[0],)) distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1


Failed cleaning build dir for cryptography Running setup.py bdist_wheel for cffi ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-sE3Q5U/cffi/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/tmpAyNrVOpip-wheel- --python-tag cp27: Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found running bdist_wheel running build running build_py creating build creating build/lib.linux-armv7l-2.7 creating build/lib.linux-armv7l-2.7/cffi copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/init.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/recompiler.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/commontypes.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/error.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/ffiplatform.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/api.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/lock.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/model.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/cparser.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/verifier.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/vengine_gen.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/_cffi_include.h -> build/lib.linux-armv7l-2.7/cffi copying cffi/parse_c_type.h -> build/lib.linux-armv7l-2.7/cffi copying cffi/_embedding.h -> build/lib.linux-armv7l-2.7/cffi copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-2.7/cffi running build_ext building '_cffi_backend' extension creating build/temp.linux-armv7l-2.7 creating build/temp.linux-armv7l-2.7/c 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-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

include

               ^

compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1


Failed building wheel for cffi Running setup.py clean for cffi Failed to build cryptography cffi Installing collected packages: urwid, urllib3, idna, chardet, certifi, requests, demjson, appdirs, xbox-webapi, construct, aenum, pycparser, cffi, greenlet, gevent, dpkt, asn1crypto, six, enum34, ipaddress, cryptography, xbox-smartglass-core Running setup.py install for cffi ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-sE3Q5U/cffi/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-xJqYGp-record/install-record.txt --single-version-externally-managed --compile --user --prefix=: Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containinglibffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found running install running build running build_py creating build creating build/lib.linux-armv7l-2.7 creating build/lib.linux-armv7l-2.7/cffi copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/init.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/recompiler.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/commontypes.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/error.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/ffiplatform.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/api.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/lock.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/model.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/cparser.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/verifier.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/vengine_gen.py -> build/lib.linux-armv7l-2.7/cffi copying cffi/_cffi_include.h -> build/lib.linux-armv7l-2.7/cffi copying cffi/parse_c_type.h -> build/lib.linux-armv7l-2.7/cffi copying cffi/_embedding.h -> build/lib.linux-armv7l-2.7/cffi copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-2.7/cffi running build_ext building '_cffi_backend' extension creating build/temp.linux-armv7l-2.7 creating build/temp.linux-armv7l-2.7/c 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-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

include

                 ^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-sE3Q5U/cffi/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-xJqYGp-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-sE3Q5U/cffi/

it may be worth noting that I originally tried this with home assistant than figured a way to use the python scripts to work with homebridge using cmdswitch2. maybe I need to re-install the home assistant plugin to allow this to install properly?

tuxuser commented 5 years ago

apt install libffi-dev

tuxuser commented 5 years ago

And you wanna use Python 3.5 or higher.. as the README states

tuxuser commented 5 years ago

Is the issue solved?

mreassassin commented 5 years ago

not really... I tried 'apt install libffi-dev' which seemed to install (saw progress bars and such) but when I tried to run one of the scripts it would not work. my workaround has been to create a virtual environment (found this from the homeassistant plugin page) and activate it before running the scripts (which I have some being called from homebridge via cmdswitch2).

I didn't used to have to activate the virtual environment before... how do I make it so I don't need to activate a virtual environment?

tuxuser commented 5 years ago

Depends on your used python virtual environment system https://www.google.com/search?q=python+virtual+environment+automatically+activate