Python version bundled with openwrt

Does a version of Python come bundled with latest OpenWrt? If so, what version?[Name_pkg-dependencies*~]=python

Be aware that you may/will have problems with pip that requires building of source into a module. Python packages of that type "need" top be build on a build machine, not on the target. I've also never had much success with venv use under OpenWrt.

Thanks for the responses. I am actually hoping to get PIP in the Python package bundled with OpenWRT. The Arduino I am using is out of memory trying to run So I am hoping to get it as part of a package somewhere.

Just downloaded Python 3.6.4 through OPKG but PIP does not appear to be included.

Check the package lists, pip (2/3) should be available as a package, as well as many of the “normal” Python packages. Because of device constraints, the Python package itself is very bare bones.

Edit: Looks like python3-pip and python3-setuptools as a start.


Thank you VERY much for your help. I now have PIP but the Arduino is running out of memory when I run it to install Flask. Is Flask available as a package as well?



I think you need more appropriate hardware if you’re going to be running what sounds to be a Python web app.

I am following the recipe here on adafruit, so I assuming its possible?

Ah, OK, they're "ignoring" that Flask isn't really a web server. Usually it is run behind something like nginx and uWSGI.

Those directions you link state:

pip install --target /mnt/sda1/python-packages flask

so I'd modify that for your environment.

I'm not sure how you're going to get a binary compiled with the Arduino tool chain to run under OpenWrt, but that may lead you to some questions and answers about the inner workings of operating systems.

I'd also be aware that Adafruit's Circuit Python is based on microPython, which is very different in its memory usage than typical Python, for which the reference implementation is CPython.

Looks like you can get Flask through opkg:
opkg install python3-flask

Using pip to get Flask causes OOM error on the Arduino.

That likely won't be the only OOM problem you run into trying to run Python on a device with only 64 MB of RAM.

While you're getting it all running, you might want to see what other services are consuming RAM and which you can do without for a bit. top or the package htop can provide some insight. Looking at some of my ath79 devices, with "fresh" flash of firmware, "nothing" installed (OpenWrt "defaut" packages and services running), and without wireless runnning, they consume ~25 MB of RAM.

My use of an 8 GB micro sim card can expand the amount of flash memory on the Arduino Yun, correct? Off the shelf I think it only has 16 MB of flash memory.

It’s the RAM that will likely bite you, not “disk” storage. Swap isn’t really viable between slow write speeds and flash wear.

I got everything installed over the weekend. However, the Flask-based web page ran out of memory and would not load in a broswer. For Arduino applications, what is the best choice for web servers? I am seeing that Bottle might be a better choice.