15

How do I check if my installed numpy version is 32bit or 64bit?

Bonus Points for a solution which works inside a script and is system independent.

4
  • 5
    SO has Bonus Points now!? Does it feel better than bounty points?
    – Divakar
    Nov 5, 2015 at 19:52
  • Though I feel not required to answer the question - because someone will ask "why?" I suspect I am having memory problems because I can create very large lists in python without using numpy, but as soon as I do use numpy, I get a np.zeros memory error.
    – D A
    Nov 5, 2015 at 19:53
  • @Divakar If you find the answer I seek: I will personally give you 10 D Adams bonus points which can not be redeemed anywhere for anything, and do not constitute legal tender.
    – D A
    Nov 5, 2015 at 19:55
  • To finish my first comment - I figured out my memory problem. What confused me was that numpy is smart enough to figure out that I do not possess enough memory on the machine to create the array on allocation BEFORE starting to use memory on the machine. So my system monitor didn't see me using any memory. Appending to python lists iteratively allowed my process to keep using more and more until it crashed as I expected it too.
    – D A
    Nov 5, 2015 at 20:31

2 Answers 2

22
In [65]: import numpy.distutils.system_info as sysinfo

In [69]: sysinfo.platform_bits
Out[69]: 64

This is based on the value returned by platform.architecture():

In [71]: import platform
In [72]: platform.architecture()
Out[74]: ('64bit', 'ELF')
0
6

64 bit python won't load 32 bit NumPy (at least that has been my experience with 2.7.10 python and "official" distribution of NumPy for Windows). So start Python (if you have both 32 bit version and 64 bit version do it for each one) and then try to import NumPy module. If it works with 32 bit Python, then it's a 32 bit version of NumPy. If it works with 64 bit Python, then it's a 64 bit version of NumPy.

2
  • I was not aware that you cannot load 32bit numpy with 64bit python. Do you have any source for this?
    – D A
    Nov 5, 2015 at 19:59
  • 2
    @D Adams, I tried it. It doesn't find the module. It makes sense, btw. NumPy is natively compiled. It's not a Python-only module. Nov 5, 2015 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.