numpy asarray float32 works on Ubuntu but not Windows 7

Question:

I followed the instructions here

Steps 1 and 2 have been checked. My Intel(R) Core(TM) i7-2860QM CPU @ 2.50GHz CPU can support 64-bit and Intel virtalization tech and it is currently using virtualization tech according to my BIOS. Checking step 3: I’m on Ubuntu so no antivirus software and I’m not running any system level debugging. Now see the attached image, even though I set the VM to be 64-bit on the left, it is still 32-bit on the right.

enter image description here

I know that the settings are merely for organizational purposes and that they can’t actually change the bitness of the VM. I downloaded the VM here – https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/linux/. None of them are marked as 64-bit, so I do not know how to guarantee that I have a 64-bit Windows image

This is not the main issue I’m trying to solve though. It has been inferred as being the cause of my main issue.


Same code works on Ubuntu 14.04 but not the Windows 7 VM. Below you’ll see me debugging and all variables look identical.

enter image description here

Next I type the error-causing line into the console and sure enough on one OS we have no issues and on the other we blow up

enter image description here

>>> np.asarray(frames, dtype=np.float32)
    Traceback (most recent call last):
      File "C:Program FilesJetBrainsPyCharm 2016.1.2helperspydev_pydevd_bundlepydevd_exec.py", line 3, in Exec
        exec exp in global_vars, local_vars
      File "<input>", line 1, in <module>
      File "C:Python27libsite-packagesnumpycorenumeric.py", line 482, in asarray
        return array(a, dtype, copy=False, order=order)
    MemoryError

Now the part that gives me the creeps. When I go back to the debugging tab from the console in Ubuntu I see many new variables have spontaneously been created even though I only typed one line into the Python console

enter image description here

enter image description here

I figure there should be a package problem.

I’m using Python 2.7.11 on the Windows 7 VM and these packages are installed

FITS-tools  0.0.dev0    
Pillow  3.2.0   3.2.0
Pillow-PIL  0.1.dev0    0.1dev
PyQt4   4.11.4  4.11.4
astropy 1.1.2   1.1.2
cycler  0.10.0  
image-registration  0.2.2.dev272    
matplotlib  1.5.1   1.5.1
numpy   1.11.0  1.11.0
parmap  1.2.3   1.2.3
pip 8.1.1   8.1.1
pyfits  3.4 3.4
pyparsing   2.1.1   2.1.1
pyqtgraph   0.9.10  0.9.10
python-dateutil 2.5.3   2.5.3
pytz    2016.4  2016.4
scipy   0.17.0  0.17.0
setuptools  20.10.1 21.0.0
six 1.10.0  1.10.0
wheel   0.29.0  0.29.0

On Ubuntu – to my surprise – I’m using Python 2.7.6 (and for some reason I get a make: *** [libinstall] Error 1 when I try to upgrade to 2.7.11 but that’s another issue). Here are the packages I ave installed on the working Ubuntu side

BeautifulSoup   3.2.1   3.2.1
CherryPy    3.2.2   5.3.0
Cython  0.22    0.24
Django  1.9.1   1.9.6
Markdown    2.4 2.6.6
PAM 0.4.2   
Pillow  2.3.0   3.2.0
PyOpenGL    3.0.2   3.1.1a1
Pygments    1.6 2.1.3
Routes  2.0 2.3.1
Twisted-Core    13.2.0  
Twisted-Web 13.2.0  
VTK 5.8.0   
WebOb   1.3.1   1.6.0
adium-theme-ubuntu  0.3.4   
amqplib 1.0.2   1.0.2
apptools    4.3.0   4.4.0
apsw    3.8.2-r1    3.9.2-r1
apt-xapian-index    0.45    
argparse    1.2.1   1.4.0
astropy 1.1.2   1.1.2
cffi    0.8.6   1.6.0
chardet 2.0.1   2.3.0
colorama    0.2.5   0.3.7
command-not-found   0.3 
configobj   5.0.6   5.0.6
cssselect   0.9.1   0.9.1
cssutils    0.9.10  1.0.1
debtagshw   0.1 
defer   1.0.6   1.0.4
deluge  1.3.6   
dirspec 13.10   13.08
dnspython   1.11.1  1.12.0
duplicity   0.6.23  
envisage    4.1.0   4.5.1
feedparser  5.1.3   5.2.1
h5py    2.2.1   2.6.0
html5lib    0.999   0.9999999
httplib2    0.8 0.9.2
image-registration  0.2.2.dev272    
ipython 3.1.0   4.2.0
libtfr  1.0.4   2.0.0b4
lockfile    0.8 0.12.2
lxml    3.3.3   3.6.0
matplotlib  1.4.3   1.5.1
mayavi  4.4.3   4.4.4
mechanize   0.2.5   0.2.5
mock    1.0.1   2.0.0
netifaces   0.8 0.10.4
nose    1.3.7   1.3.7
numexpr 2.2.2   2.5.2
numpy   1.9.2   1.11.0
oauthlib    0.6.1   1.1.1
oneconf 0.3.7.14.04.1   0.0.1.dev0
pandas  0.16.1  0.18.1
parmap  1.2.3   1.2.3
pexpect 3.1 4.0.1
pip 1.5.4   8.1.1
piston-mini-client  0.7.5   0.7.5
plotly  1.6.17  1.9.10
ply 3.4 3.8
py  1.4.31  1.4.31
pyFFTW  0.9.2   0.10.1
pyOpenSSL   0.13    16.0.0
pycparser   2.10    2.14
pycrypto    2.6.1   2.6.1
pycups  1.9.66  1.9.73
pyface  5.0.0   5.1.0
pygame  1.9.1release    
pygobject   3.12.0  
pygpgme 0.3 0.3
pyparsing   2.0.3   2.1.1
pyqtgraph   0.9.10  0.9.10
pyserial    2.6 3.0.1
pysmbc  1.0.14.1    1.0.15.5
pytest  2.9.1   2.9.1
python-apt  0.9.3.5ubuntu2  0.7.8
python-dateutil 2.4.2   2.5.3
python-debian   0.1.21-nmu2ubuntu2  0.1.23
python-libtorrent   0.16.13 1.1.0
pytz    2015.4  2016.4
pyxdg   0.25    0.25
pyzmq   14.7.0  15.2.0
reportlab   3.0 3.3.0
repoze.lru  0.6 0.6
requests    2.2.1   2.10.0
scikit-learn    0.17.1  0.17.1
scipy   0.15.1  0.17.0
sessioninstaller    0.0.0   
setuptools  3.3 21.0.0
simplejson  3.7.3   3.8.2
six 1.5.2   1.10.0
sklearn 0.0 0.0
software-center-aptd-plugins    0.0.0   
system-service  0.1.6   
tables  3.1.1   3.2.2
traits  4.5.0   4.5.0
traitsui    5.0.0   5.1.0
uTidylib    0.2 0.2
unity-lens-photos   1.0 
urllib3 1.7.1   1.15.1
vboxapi 1.0 1.0
wheel   0.24.0  0.29.0
wsgiref 0.1.2   0.1.2
wxPython    2.8.12.1    2.9.1.1
wxPython-common 2.8.12.1    2.6.3.3
xdiagnose   3.6.3build2 
xppy    0.7.0   
zope.interface  4.0.5   4.1.3
Asked By: Frikster

||

Answers:

You’ve got MemoryError. Means you requested allocation which is beyond available memory on your VM. Some potential reasons:

  • not enough memory allocated for VM (try to increase it)
  • 2GB limit for process on Windows (run LARGEADDRESSAWARE python or move to 64 bit)
  • memory corruption so your heap is corrupted (debug your code)

Similar discussion Memory errors and list limits?

Answered By: Severin Pappadeux