aws/aws-iot-device-sdk-arduino-yun

Running out of memory on yun rev 2 while trying to install sdk

Opened this issue · 5 comments

I'm trying to install the AWSIoTPythonSDK manually using pip on my yun rev 2 but I keep getting an out of memory error and not sure how to proceed. The stack trace is as follows:

Error [Errno 12] Out of memory while executing command python setup.py egg_info
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 439, in run_egg_info
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 667, in call_subprocess
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
  File "/usr/lib/python2.7/subprocess.py", line 917, in _execute_child
OSError: [Errno 12] Out of memory

Any help would be greatly appreciated. The board is new and the reason I'm installing the SDK manually is that I couldn't install the distribute package using the guide. So I installed pip manually but now have this issue while trying to run pip install AWSIoTPythonSDK==1.0.0 and don't know how to proceed.

I have the same problem!
Anyone help?

You have to add an SD card:

https://www.arduino.cc/en/Tutorial/ExpandingYunDiskSpace

EDIT: Scratch that, I added the SD card and I got the same error.

Same issue here. I partitioned 4GB of additional space from the SD card. I restarted the board and IDE but no luck.

Hey @grownanny I figured it out.

Error [Errno 12] Out of memory while executing command python setup.py egg_info
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 439, in run_egg_info
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 667, in call_subprocess
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
  File "/usr/lib/python2.7/subprocess.py", line 917, in _execute_child
OSError: [Errno 12] Out of memory

You're getting this error because while the Arduino Yun has enough disk space now with the SD, it is running out of RAM. In order to install the AWSIoTPythonSDK, we need to allocate it some 'swap memory'. 8. You can read more information and a more in-depth tutorial about swap memory here, but I will be including abbreviated directions here for convenience. *

First, ssh into the Arduino Yun by typing ssh root@<yourarduinoname>.local. Then, in the terminal, run: free -m. You should see your current free memory:

             total       used       free     shared    buffers     cached
Mem:         59932      45652      14280         80      25124       2960
-/+ buffers/cache:      17568      42364
Swap:            0          0          0

Notice how there is no swap memory. To add swap memory, follow the next few steps.

Create an empty file to act as a swap file by running: dd if=/dev/zero of=/yunswapfile bs=1M count=512. This should take a bit of time and produce this output:

512+0 records in
512+0 records out

Designate the file as a Swap file by running: mkswap /yunswapfile
Load the swap file for verifying by running: swapon /yunswapfile
Verify everything is working so far by running: free -m. You should see swap memory has been allocated:

             total       used       free     shared    buffers     cached
Mem:         59932      45652      14280         80      25124       2960
-/+ buffers/cache:      17568      42364
Swap:       524284          0     524284

Now we need to make the swap permanent. Run vim /etc/fstab and add the following line to the fstab:
/yunswapfile none swap sw 0 0
We now have enough memory to install the AWSIoTPythonSDK. However, we need to run two more steps, because otherwise, you'll get more errors.

Upgrade to the latest version of pip by running curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py and then python2.7 get-pip.py --force-reinstall.
Upgrade the pip installation tools by running: pip install --upgrade setuptools.
Finally, we can install the SDK. Run pip install AWSIoTPythonSDK==1.0.0.
Check to see if it works using pip show AWSIoTPythonSDK.

Hopefully this helps a lot. I had to go through a lot of failed troubleshooting attempts and research before I finally stumbled onto that one article. More research then allowed me to finally install the SDK.