eclipse / upm

UPM is a high level repository that provides software drivers for a wide variety of commonly used sensors and actuators. These software drivers interact with the underlying hardware platform through calls to MRAA APIs.
MIT License
658 stars 411 forks source link

ImportError: cannot import name 'pyupm_jhd1313m1' from 'upm' #696

Open jpelletier opened 4 years ago

jpelletier commented 4 years ago

When trying to run an example, it display this message.

babourn commented 4 years ago

+1 Having the same issue with BMI160

babourn commented 4 years ago

Partial fix/ possible issue with the install: I copied two python files into dist-packages in order to give python 3 access to the *.py files rather than the *.so files

sudo cp build/src/bmi160/python3.5/pyupm_bmi160.py /usr/local/lib/python3.5/dist-packages/upm sudo cp build/interfaces/python3.5/pyupm_interfaces.py /usr/local/lib/python3.5/dist-packages/upm

and that seemed to get everything working for my accelerometer.

jpelletier commented 3 years ago

I tried babourn's fix (copied the python files from the upm library, cloned from github). files to copy: upm/build/src/lcd/python3.9/pyupm_lcd.py upm/build/src/jhd1313m1/python3.9/pyupm_jhd1313m1.py upm/build/interfaces/python3.9/pyupm_interfaces.py

It worked for the LCD. There is a test program in humid_temp (examples from the Sensor mezzanine). python3 test_lcd.py

There is another issue preventing the communication between the dragonboard and the arduino.

g-vidal commented 3 years ago

Hi @jpelletier I have not been on upm for long I did not take the time to read what happened and I might be out of the track, but I have compiled mraa and upm to put them in a raspberryPi image I am distributing to colleagues. I face the same problem The reason is : In folder /usr/lib/pythonX.Y/dist-packages/upm thereare only _pyupm_*.so libraries and no pyupm_*.py this could be normal if the __init__.py file contained all the necessary commands to retrieve module names from the libraries and unfortunately it is empty ! The workaround I found was to copy all.py files from the src/pythonX.Y and interfaces/pythonX.Y folder . Your problem may appear because of a dependency or interface problem.

I am using jhd1313m1 BME280 TSL2561 MCP9808 as a mini-weatherstation demo and everything is OK with upm.

here is the command I used in case it helps :

from build folder

for i in python2.7 python3.7 ; do sudo cp src//$i/.py /usr/lib/$i/dist-packages/upm/; done for i in python2.7 python3.7 ; do sudo cp interfaces/$i/*.py /usr/lib/$i/dist-packages/upm/; done