Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to use numpy But I am facing following error numpy.core._exceptions.MemoryError: Unable to allocate array with shape 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 numpy.core._exceptions.MemoryError: Unable to allocate array with shape Error Occurs ?
I am trying to use numpy But I am facing following error.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
numpy.core._exceptions.MemoryError: Unable to allocate array with shape (789412, 78, 98754) and data type uint8
Here is my Code.
nmp.zeros((789412, 78, 98754), dtype='uint8')
How To Solve numpy.core._exceptions.MemoryError: Unable to allocate array with shape Error ?
- How To Solve numpy.core._exceptions.MemoryError: Unable to allocate array with shape Error ?
To Solve numpy.core._exceptions.MemoryError: Unable to allocate array with shape Error Just increase pagefile in your windows 10. Just follow this step. First of all Press the Windows key Then, Type SystemPropertiesAdvanced Now, Click Run as administrator Under Performance, click Settings Then, Select the Advanced tab Now, Select Change… Uncheck Automatically managing paging file size for all drives Then select Custom size and fill in the appropriate size Now, Press Set then press OK then exit from the Virtual Memory, Performance Options, and System Properties Dialog Reboot your system. Now your error should be solved.
- numpy.core._exceptions.MemoryError: Unable to allocate array with shape
To Solve numpy.core._exceptions.MemoryError: Unable to allocate array with shape Error Just increase pagefile in your windows 10. Just follow this step. First of all Press the Windows key Then, Type SystemPropertiesAdvanced Now, Click Run as administrator Under Performance, click Settings Then, Select the Advanced tab Now, Select Change… Uncheck Automatically managing paging file size for all drives Then select Custom size and fill in the appropriate size Now, Press Set then press OK then exit from the Virtual Memory, Performance Options, and System Properties Dialog Reboot your system. Now your error should be solved.
Solution 1: Increase pagefile
Just increase pagefile in your windows 10. Just follow this step.
- First of all Press the Windows key
- Then, Type SystemPropertiesAdvanced
- Now, Click Run as administrator
- Under Performance, click Settings
- Then, Select the Advanced tab
- Now, Select Change…
- Uncheck Automatically managing paging file size for all drives
- Then select Custom size and fill in the appropriate size
- Now, Press Set then press OK then exit from the Virtual Memory, Performance Options, and System Properties Dialog
- Reboot your system
- Now your error should be solved.
Solution 2: change dtype to uint8
Just change dtype to uint8.
from
mask = nmp.zeros(edges.shape)
to
mask = nmp.zeros(edges.shape,dtype='uint8')
Summary
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?
Also, Read