Reputation: 86
Straight to it:
23.10.19 20:20:23 (+0100) main File "server.py", line 1, in <module>
23.10.19 20:20:23 (+0100) main from gadget import Gadget
23.10.19 20:20:23 (+0100) main File "/usr/src/app/src/gadget.py", line 3, in <module>
23.10.19 20:20:23 (+0100) main from agt import AlexaGadget
23.10.19 20:20:23 (+0100) main File "/agt/src/agt/__init__.py", line 29, in <module>
23.10.19 20:20:23 (+0100) main from agt.alexa_gadget import AlexaGadget
23.10.19 20:20:23 (+0100) main File "/agt/src/agt/alexa_gadget.py", line 24, in <module>
23.10.19 20:20:23 (+0100) main from agt.bluetooth import BluetoothAdapter
23.10.19 20:20:23 (+0100) main File "/agt/src/agt/bluetooth.py", line 21, in <module>
23.10.19 20:20:23 (+0100) main from gi.repository import GObject
23.10.19 20:20:23 (+0100) main File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
23.10.19 20:20:23 (+0100) main from . import _gi
23.10.19 20:20:23 (+0100) main ImportError: cannot import name '_gi'
I've been toying with the Alexa Gadgets Toolkit which uses python3-gi (dependencies it installs can be found here) and have hit a snag.
For context, I'm using Balena's Raspbian with Python Docker image, on a Pi Zero W. It just seems to completely fail when launching because it can't load the _gi module.
I've tried various Python version (3.4, 3.5, 3.6, 3.7) with no avail, and also tried installing various dependencies manually, using pip via python -m pip
to ensure the right pip was used, etc. No luck. Python 2.7 doesn't work at all either due to an encoding issue in the AGT library, however it looks like it's expected to be used with 3.x anyway.
Upvotes: 0
Views: 3089
Reputation: 86
Solution!
It turns out that the .so module for GI simply needed to have the "34m" renamed to "36m", so I added these to my Dockerfile and it runs just fine now
RUN sudo mv /usr/lib/python3/dist-packages/gi/_gi.cpython-34m-arm-linux-gnueabihf.so /usr/lib/python3/dist-packages/gi/_gi.cpython-36m-arm-linux-gnueabihf.so
RUN sudo mv /usr/lib/python3/dist-packages/gi/_gi_cairo.cpython-34m-arm-linux-gnueabihf.so /usr/lib/python3/dist-packages/gi/_gi_cairo.cpython-36m-arm-linux-gnueabihf.so
Upvotes: 1