How to solve MemoryError 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 Exception: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) . . MemoryError
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.