Hey there
Is there a python libary available for the RockPI S gpio´s ?
Greetings
Hey there
Is there a python libary available for the RockPI S gpio´s ?
Greetings
My RockPiS arrived this week .
I use the Armbian Distro and installed libmraa like the description :
export DISTRO=buster-testing # for Buster
echo “deb http://apt.radxa.com/$DISTRO/ ${DISTRO%-*} main” | sudo tee -a /etc/apt/sources.list.d/apt-radxa-com.list
Get the pub key
wget -O - apt.radxa.com/buster-testing/public.key | sudo apt-key add -
Install essential packages:
sudo apt-get update
sudo apt-get install -y rockchip-overlay rockpis-dtbo libmraa-rockpis
but “import mraa” does not work with Python
What i have do too else?
greetings
Hello I tired it again on:
Armbian Bionic with Linux 4.4.207-rockpis Linux rockpi-s 4.4.207-rockpis #7 SMP PREEMPT Mon Feb 17 10:07:38 CET 2020 aarch64 aarch64 aarch64 GNU/Linux
pi@rockpi-s:~$ sudo apt-get install -y rockchip-overlay rockpis-dtbo libmraa-rockpis
Reading package lists… Done
Building dependency tree
Reading state information… Done
libmraa-rockpis is already the newest version (0.3).
rockchip-overlay is already the newest version (2.6).
rockpis-dtbo is already the newest version (4.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@rockpi-s:~$ ^C
pi@rockpi-s:~$ python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.import mraa
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘mraa’
But stil the same "No module named ‘mraa’.
Why is this Module missing?
We updated kernel today. Try if its working now: apt update & apt upgrade
i tried with a fresh img:
apt update
apt install wget
export DISTRO=bionic-testing
echo “deb http://apt.radxa.com/$DISTRO/ ${DISTRO%-*} main” | sudo tee -a /etc/apt/sources.list.d/apt-radxa-com.list
wget -O - apt.radxa.com/buster-testing/public.key | sudo apt-key add -
apt-get update
apt-get install -y rockchip-overlay rockpis-dtbo libmraa-rockpis
apt upgrade -y
apt dist-upgrade -y
same result module not found
root@rockpis:/etc/ssh# sudo apt dist-upgrade -y
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@rockpis:/etc/ssh# sudo apt-get install -y rockchip-overlay rockpis-dtbo libmraa-rockpis
Reading package lists… Done
Building dependency tree
Reading state information… Done
rockchip-overlay is already the newest version (2.6).
rockpis-dtbo is already the newest version (4.4).
libmraa-rockpis is already the newest version (0.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@rockpis:/etc/ssh# python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.import mraa
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘mraa’
Can you provide armbianmonitor -u?
The librmaa-rockpis
does not contain python bindings - it only contains examples.
That’s why the module cannot be found
root@rockpi-s:~# dpkg -L libmraa-rockpis
/.
/usr
/usr/local
/usr/local/bin
/usr/local/bin/mraa-gpio
/usr/local/bin/mraa-i2c
/usr/local/bin/mraa-uart
/usr/local/include
/usr/local/include/mraa
/usr/local/include/mraa/aio.h
/usr/local/include/mraa/aio.hpp
/usr/local/include/mraa/common.h
/usr/local/include/mraa/common.hpp
/usr/local/include/mraa/firmata.h
/usr/local/include/mraa/gpio.h
/usr/local/include/mraa/gpio.hpp
/usr/local/include/mraa/i2c.h
/usr/local/include/mraa/i2c.hpp
/usr/local/include/mraa/iio.h
/usr/local/include/mraa/iio.hpp
/usr/local/include/mraa/iio_kernel_headers.h
/usr/local/include/mraa/initio.h
/usr/local/include/mraa/initio.hpp
/usr/local/include/mraa/led.h
/usr/local/include/mraa/led.hpp
/usr/local/include/mraa/pwm.h
/usr/local/include/mraa/pwm.hpp
/usr/local/include/mraa/spi.h
/usr/local/include/mraa/spi.hpp
/usr/local/include/mraa/types.h
/usr/local/include/mraa/types.hpp
/usr/local/include/mraa/uart.h
/usr/local/include/mraa/uart.hpp
/usr/local/include/mraa/uart_ow.h
/usr/local/include/mraa/uart_ow.hpp
/usr/local/include/mraa.h
/usr/local/include/mraa.hpp
/usr/local/lib
/usr/local/lib/libmraa.so.2.0.0
/usr/local/lib/pkgconfig
/usr/local/lib/pkgconfig/mraa.pc
/usr/local/share
/usr/local/share/mraa
/usr/local/share/mraa/examples
/usr/local/share/mraa/examples/CMakeLists.txt
/usr/local/share/mraa/examples/c
/usr/local/share/mraa/examples/c/CMakeLists.txt
/usr/local/share/mraa/examples/c/aio.c
/usr/local/share/mraa/examples/c/gpio.c
/usr/local/share/mraa/examples/c/gpio_advanced.c
/usr/local/share/mraa/examples/c/gpio_multiple_rw.c
/usr/local/share/mraa/examples/c/hellomraa.c
/usr/local/share/mraa/examples/c/i2c_hmc5883l.c
/usr/local/share/mraa/examples/c/i2c_mpu6050.c
/usr/local/share/mraa/examples/c/iio.c
/usr/local/share/mraa/examples/c/initio.c
/usr/local/share/mraa/examples/c/led.c
/usr/local/share/mraa/examples/c/pwm.c
/usr/local/share/mraa/examples/c/spi.c
/usr/local/share/mraa/examples/c/uart.c
/usr/local/share/mraa/examples/c/uart_advanced.c
/usr/local/share/mraa/examples/c/uart_ow.c
/usr/local/share/mraa/examples/c++
/usr/local/share/mraa/examples/c++/CMakeLists.txt
/usr/local/share/mraa/examples/c++/aio.cpp
/usr/local/share/mraa/examples/c++/gpio.cpp
/usr/local/share/mraa/examples/c++/gpio_advanced.cpp
/usr/local/share/mraa/examples/c++/i2c.cpp
/usr/local/share/mraa/examples/c++/iio.cpp
/usr/local/share/mraa/examples/c++/led.cpp
/usr/local/share/mraa/examples/c++/pwm.cpp
/usr/local/share/mraa/examples/c++/spi.cpp
/usr/local/share/mraa/examples/c++/uart.cpp
/usr/local/share/mraa/examples/c++/uart_ow.cpp
/usr/local/share/mraa/examples/java
/usr/local/share/mraa/examples/java/AioA0.java
/usr/local/share/mraa/examples/java/BlinkIO.java
/usr/local/share/mraa/examples/java/BlinkOnboard.java
/usr/local/share/mraa/examples/java/Bmp85.java
/usr/local/share/mraa/examples/java/CyclePwm3.java
/usr/local/share/mraa/examples/java/Example.java
/usr/local/share/mraa/examples/java/FTDITest.java
/usr/local/share/mraa/examples/java/GpioMmapped.java
/usr/local/share/mraa/examples/java/GpioRead6.java
/usr/local/share/mraa/examples/java/HelloEdison.java
/usr/local/share/mraa/examples/java/I2cCompass.java
/usr/local/share/mraa/examples/java/Isr.java
/usr/local/share/mraa/examples/java/SpiMAX7219.java
/usr/local/share/mraa/examples/java/SpiMCP4261.java
/usr/local/share/mraa/examples/java/UartExample.java
/usr/local/share/mraa/examples/javascript
/usr/local/share/mraa/examples/javascript/AioA0.js
/usr/local/share/mraa/examples/javascript/Blink-IO.js
/usr/local/share/mraa/examples/javascript/GPIO_DigitalRead.js
/usr/local/share/mraa/examples/javascript/GPIO_DigitalWrite.js
/usr/local/share/mraa/examples/javascript/bmp85.js
/usr/local/share/mraa/examples/javascript/firmata.js
/usr/local/share/mraa/examples/javascript/gpio-tool.js
/usr/local/share/mraa/examples/javascript/initio.js
/usr/local/share/mraa/examples/javascript/isr.js
/usr/local/share/mraa/examples/javascript/rgblcd.js
/usr/local/share/mraa/examples/javascript/spi.js
/usr/local/share/mraa/examples/javascript/uart.js
/usr/local/share/mraa/examples/platform
/usr/local/share/mraa/examples/platform/CMakeLists.txt
/usr/local/share/mraa/examples/platform/Up2Leds.java
/usr/local/share/mraa/examples/platform/firmata_curie_imu.c
/usr/local/share/mraa/examples/platform/gpio_edison.c
/usr/local/share/mraa/examples/platform/i2c_firmata.c
/usr/local/share/mraa/examples/platform/initio.c
/usr/local/share/mraa/examples/platform/initio.cpp
/usr/local/share/mraa/examples/platform/initio.py
/usr/local/share/mraa/examples/platform/intel-aero.json
/usr/local/share/mraa/examples/platform/turbotjson.json
/usr/local/share/mraa/examples/platform/up2-leds.cpp
/usr/local/share/mraa/examples/python
/usr/local/share/mraa/examples/python/aio.py
/usr/local/share/mraa/examples/python/firmata.py
/usr/local/share/mraa/examples/python/gpio.py
/usr/local/share/mraa/examples/python/gpio_advanced.py
/usr/local/share/mraa/examples/python/i2c_bmp85.py
/usr/local/share/mraa/examples/python/i2c_rgb.py
/usr/local/share/mraa/examples/python/led.py
/usr/local/share/mraa/examples/python/pwm.py
/usr/local/share/mraa/examples/python/spi.py
/usr/local/share/mraa/examples/python/spi_loopback.py
/usr/local/share/mraa/examples/python/uart.py
/usr/local/share/mraa/examples/python/uart_receiver.py
/usr/local/share/mraa/examples/python/uart_sender.py
/usr/local/share/mraa/examples/samples.mapping.txt
/usr/local/lib/libmraa.so
/usr/local/lib/libmraa.so.2
I’m so sorry, pumuckll.Due to our PIS compiling libmraa library, we did not choose to compile Python library. You can download our libmraa library and compile it yourself.
The steps to compile are:
1.Some dependency libraries need to be installed before Compilation,
sudo apt-get install git build-essential swig3.0 python-dev python3-dev nodejs-dev cmake libjson-c-dev
2.cd libmraa
Open cmakelists.txt file
Find the following content, modify the configuration to choose to compile the support of different libraries
option (BUILDDOC “Build all doc.” OFF)
option (BUILDSWIG “Build swig modules.” ON)
option (BUILDSWIGPYTHON “Build swig python modules.” ON)
option (BUILDSWIGNODE “Build swig node modules.” ON)
option (BUILDSWIGJAVA “Build Java API.” OFF)
option (USBPLAT “Detection USB platform.” OFF)
option (FIRMATA “Add Firmata support to mraa.” OFF)
option (ONEWIRE “Add Onewire support to mraa.” ON)
option (JSONPLAT “Add Platform loading via a json file.” ON)
option (IMRAA “Add Imraa support to mraa.” OFF)
option (FTDI4222 “Build with FTDI FT4222 subplatform support.” OFF)
option (ENABLEEXAMPLES “Disable building of examples” ON)
option (INSTALLTOOLS “Install all tools” ON)
option (BUILDTESTS “Override the addition of tests” ON)
option (USEPYTHON3TESTS “Force tests to run with python3” OFF)
3.mkdir build
cd build
cmake …
make
sudo make install
Or we can recompile the python support and give you a new version
thanks for the information
I will try to compile it,but I would recommend too include it in future.
Where could i download it?
We have compiled the new libmraa library and are preparing to upload it
cool many thanks
in that case i will wait for it
Hello everyone. I am waiting for the compiled library too. When it would be ready?
It’s already in the testing repo, just update it.
Really, how? I did the install just as showed in the wiki and updated but I couldn’t use it in python, it gave the module not found error. Is there a specific way to install? Thanks for the help.
Hi, I have retried it with the testing repo given on the libmraa page, however I just cant even make it import mraa in pyhton. Feeling too sad…
Can you check the libmraa version?
apt list libmraa-rockpis
@Stephen I think we have pushed the libmraa with ROCK Pi 4 and ROCK Pi S support?
exact response to that command: /unknown, now 0.3 arm64 [installed]
[mraa-gpio version] response: Version v2.0.0-57-gf374a26 on Radxa ROCK Pi S
Exactly the same on me with Ubuntu-Bionic