chirale

IT and beyond

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

6 thoughts on “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.

    1. chirale says:

      At the time I was using Kivy and I was stuck by this error too. Thank you for commenting and happy python coding!

  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).

    1. chirale says:

      Thank you for posting this alternative solution. Definetely to try if you run PyCharm on a guest OS!

  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

Leave a Reply to chirale Cancel reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: