How to solve Memory Error during pip install ?

If you are trying to install a python package using pip in the embedded boards such as Raspberry Pi or any other device with less than a GB of RAM then you will encounter Memory Error.


pip  install SpeechRecognition
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/", line 215, in main
status =, args)

You can solve this using many ways one easy method is to find the package name and use “apt-get install” and install it from Debian repository instead of using a Python package repo. Or you can turn off the cache done by pip like here.

pipĀ  --no-cache-dir install SpeechRecognition

Or you can simply use a swap partition to avoid the memory crunch.

dd if=/dev/zero of=/swapfile bs=1024 count=524288
chown root:root /swapfile
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile

And then try to install again.

Leave a Reply

Your email address will not be published. Required fields are marked *