MemeoryError when sampling

I am getting the following MemoryError when sample using PyMC3 on remote server (16G memory, 4 CPUS):

I don’t have such problem on my local machine. Any clue?

Hi @nikzad, your large model with lots of samples resulting in a big preallocated trace. You should try with fewer samples and a more efficient sampler (NUTS).

I also experienced something similar. I had identical file running on my windows laptop (no issues whatsoever) and on ubuntu in AWS. The ubuntu server actually has higher specs (but no swaps). The ubuntu server could not allocate memory. I think there’s a bug somewhere.

However, I fixed it but removing all ‘start’ and ‘step’ statements. Leaving only pm.sample(2000)
That fixed it for me, hopefully it will work for you too.