Pyupm library missing?

With older releases of the debian SW for the Dragonboard 410c (the 16.09 release) I was able to run the following line of python code with no issues:

import pyupm_i2clcd

However on the latest release (the 17.09 release, installed from SDCard, with no updates or changes of any kind not even ‘sudo apt-get update’) I get the following error:

ImportError: No module named pyupm_i2clcd

I looked around and tried installing pyupm with the following command:

sudo apt-get install python-upm

but apt-get happily tells me that pyupm is already installed.

Further hunting and I found the missing pyupm module in /usr/lib/aarch64-linux-gnu/python2.7/site-packages

I can make the import sort of work if I run the following command

export PYTHONPATH=/usr/lib/aarch64-linux-gnu/python2.7/site-packages

However this only fixes the import command while running python as user linaro, however in order to actually access the i2c device I need to run python with sudo, and the PYTHONPATH fix doesn’t work.

I think the latest build has something missing, possibly presetting the PYTHONPATH, or adding something to the site file, or linking /usr/lib/aarch64-linux-gnu/sitepackages to /usr/local/python2.7/sitepackages .

What is the correct solution for this small issue?

Of course once I fixed that issue, another issue cropped up: importing pyupm_i2clcd issues an error:

File "/usr/lib/aarch64-linux-gnu/python2.7/site-packages/pyupm_i2clcd.py", line 988
SyntaxError: Non-ASCII character '\xc3' in file /usr/lib/aarch64-linux/gnu/python2.7/sitepackages/pyupm_i2clcd.py on line 989, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

There is something wrong with the library, I can fix this one by editing the pyupm_i2clcd.py file and changing the ‘\xc3’ characters to lower case ‘x’ in several places. These special characters are inside comments and make no difference to the functionality of the module.

Full Disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.

Hi Laurence

That sounds like python now points to python3 rather than python2. It doesn’t look like pyupm is packaged for python3 but you might be able to fix things by running the interpreter using the python2 command instead of just python?

No change with python2. If I just type “python” or “sudo python” to get an interactive python, the first thing it outputs is the version: “Python 2.7.13”.

Full Disclosure: I am an employee of Qualcomm Canada, any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.

Sorry about the python3 diversion. The SyntaxError misled me.

Looks like the package is out-of-date (this is a package provided by Linaro rather than by Debian so this should be reported to https://bugs.96boards.org/ ).

Problems are that /usr/lib/aarch64-linux-gnu/python2.7/site-packages has been been removed from the search path (presumably because it is bogus to put site-packages here, all per-site customization is supposed to be in /usr/local). You can work around this temporarily with:

mv  /usr/lib/aarch64-linux-gnu/python2.7/site-packages/* /usr/lib/aarch64-linux-gnu/python2.7

Likewise the syntax errors are due to the inclusion of the multiply character (instead of an “ex” character) in two of the comments. If you replace these characters with an “ex” then syntax errors will no longer be reported.reported.