Problems with python-upm: Cannot import upm

sudo apt-get install libupm-dev is not working i tried to import upm not it says module not found
but import mraa is working fine

libXXX-dev is usually for C development but you said you tried import upm which suggests you are using python rather then C. For python packages would usually look like python-XXX (e.g. python-upm).


sir, u can see here it says upm is already

Hi @alokm014,

Can you try executing the python interpreter as Sudo?

$ sudo python

Thanks,
Mani

yes, i tried but result is same :frowning:

Sorry, just remembered there are some known probems with this package. See:
https://bugs.96boards.org/show_bug.cgi?id=457

In short the workaround you need are:

  • Run export PYTHONPATH=/usr/lib/aarch64-linux-gnu/python2.7/site-packages/ (this is a bit of a pain because it stops sudo working correctly.
  • Apply additional special changes if you want pyupm_i2clcd to work correctly (remove the non-ASCII characters from the comments)
  • You can’t import upm directly (I think because the package is too old). Try to import the modules directly: import pyupm_a110x or alternatively if you are working with examples that use the following idiom from upm import pyupm_a110x as upmA110x then change them to import pyupm_a110x as upmA110x instead.

ok let suppose i don’t have upm now tell me what is the first step
is there any tutorial video on that how to use upm libraries

You need to build and install libupm from source as mentioned here.

PS: I assume that you have installed MRAA

Debian UPM package has been updated to latest version 1.6.0. So try to upgrade “python-upm” package using following cmd:

sudo apt upgrade python-upm

With upgrade successful, imports should work fine as follows:

>>> import upm
>>> from upm import pyupm_lcd
1 Like