Memory Error on pip install (SOLVED)

Memory Error when using pip install on Python can emerge both from command line or from a IDE like PyCharm, usually when the package size is big.

When you try to install a python package with pip install packagename but it fails due to a Memory Error, you can fix it in this way:

  1. Go to your console
  2. Optional: if your application is into a a virtual environment activate it
  3. pip install packagename --no-cache-dir

The package will now be downloaded with the cache disabled (see pip –help).

Thanks to David Wolever

7 responses to “Memory Error on pip install (SOLVED)”

  1. Thanks for posting that — I kept getting a memory error while trying python -m pip install kivy.deps.gstreamer and it was quite frustrating, but adding the –no-cache-dir fixed it.

  2. Brian Wylie says:

    The described solution does work and might be the right thing to do in some cases. For my case I simply needed to bump up the RAM on my VM and the MemoryError was gone and it was probably the better solution (for my case).

  3. gozie says:

    I had a challenging MemoryError exception while trying to install PySpark on a Virtual Hosted Ubuntu machine, but adding the –no -cache-dir option worked like a charm. Thanks

  4. Troy Sosa says:

    Great blog I enjooyed reading

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: