Buy some more memory!

Dominic Ford

I fear this isn’t the answer you were looking for, but if I were you I’d buy some more RAM.

Python is notoriously memory hungry, and 4GB isn’t a lot, especially if it’s being shared with other applications. I don’t know why virtual memory isn’t helping, but seemingly it isn’t. It would have been horribly slow anyway. Depending on the age of your computer, an 8GB memory module is likely to cost less than £50. The Crucial website has a system scanner to tell you exactly what parts to buy.

If you can afford it, a 16GB upgrade might be a safer bet.