0

Openembedded opkg packages for python contain pyc files. I looked at python3-dbus, and I do not see a post-install step. All python related files except the SO files are in /usr/lib/python3.8/site-packages/dbus.

If I install the Python GPS source + the compiled pyc files into:

/usr/lib/python3.8/site-packages/gps
/usr/lib/python3.8/site-packages/gps/__pycache__

If I then try to import the gps library I see:

>>> import gps
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mtadm/gps/__init__.py", line 10, in <module>
    from .gps import *
  File "/home/mtadm/gps/gps.py", line 23, in <module>
    from gpsclient import gpscommon, json_error, gpsjson, dictwrapper, GPSD_PORT
ModuleNotFoundError: No module named 'gpsclient'

Now if I compile one file in /usr/lib/python3.8/__pycache__ and copy it into place the problem goes away (the following copies one file from a tree of freshly compiled pyc files):

/tmp/python3.8/__pycache__$ sudo cp -a textwrap.cpython-38.pyc  /usr/lib/python3.8/__pycache__/
Password: 
ot0:/tmp/python3.8/__pycache__$ cd /
ot0:/$ python
Python 3.8.11 (default, Mar  9 2018, 12:34:56) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gps
>>>

I would hope there would be some other way to get the GPS library to work.

3
  • Why didn't you just pip3 install gps --user? Apr 28 at 21:36
  • This is a very old arm processor. In general we do not use PIP, because if there are any .so files it will fail. Though in this case it might work. How could I take apart the pip to see what it might do?
    – John Klug
    Apr 28 at 22:00
  • I created a new image with the package included, and did an image install, and that works. So this problem is a procedural one. Note that "opkg install python3-pygps_....ipk" does not work.
    – John Klug
    Apr 28 at 22:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.