close

[Solved] MemoryError: Unable to allocate MiB for an array with shape and data type, when using anymodel.fit() in sklearn

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error MemoryError: Unable to allocate MiB for an array with shape and data type, when using anymodel.fit() in sklearn in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How MemoryError: Unable to allocate MiB for an array with shape and data type, when using anymodel.fit() in sklearn Error Occurs?

Today I get the following error MemoryError: Unable to allocate MiB for an array with shape and data type, when using anymodel.fit() in sklearn in Python.

How To Solve MemoryError: Unable to allocate MiB for an array with shape and data type, when using anymodel.fit() in sklearn Error ?

  1. How To Solve MemoryError: Unable to allocate MiB for an array with shape and data type, when using anymodel.fit() in sklearn Error ?

    To Solve MemoryError: Unable to allocate MiB for an array with shape and data type, when using anymodel.fit() in sklearn Error Upgrading python-64 bit seems to have solved all the “Memory Error” problem.

Solution 1

Upgrading python-64 bit seems to have solved all the “Memory Error” problem.

Solution 2

The message is straight forward, yes, it has to do with the available memory.

359 MiB = 359 * 2^20 bytes = 60000 * 784 * 8 bytes

where MiB = Mebibyte = 2^20 bytes, 60000 x 784 are the dimensions of your array and 8 bytes is the size of float64.

Maybe the 3.1gb free memory is very fragmented and it is not possible to allocate 359 MiB in one piece?

A reboot may be helpful in that case.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment