Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can 32bit modules run on 64bit Python?

I wrote a genetic algorithm program using the inspyred library with a 32bit Python2.7 version on a 64bit Win7 machine. While generating the population the program stops running when it uses memory up to 1959044K.

I have read a number of questions on this site, and I understand that it is due to a 2GB cap on 32bit programs by the OS. So I have tried to switch to a 64bit Python and install the 64bit versions of the modules I was working with, unfortunately all but one module cannot run on the 64bit platform.

I also installed pywin32 as advised in another question but that has failed to help too. This module is not a standard Python library and I have pasted it below. The error message I get is:

import AoN
ImportError: DLL load failed: %1 is not a valid Win32 application.

My understanding is that the 64bit Python does not recognize the 32bit module. I also read here: http://effbot.org/zone/python-compile.htm about compiling the source code, but I have compiled the source code in 64bit but that does not help either as it continues to give that error.

Lastly I pasted the directory path of the module in the interpreter path but that does not help too.

Is there a way to have this module run on the 64bit Python? And please can anyone explain the process of compiling source codes and if that can help me out?

like image 653
Nobi Avatar asked May 14 '14 16:05

Nobi


People also ask

Does 32 bit Python work on 64bit?

Windows users can run 32-bit editions of Python on 64-bit Windows, but at a slight cost of performance. 32-bit Python, and 32-bit apps generally, can access only 4GB of memory at a time.

How do I convert Python 32 bit to 64-bit?

No we cannot upgrade python 32-bit to 64-bit. we should uninstall completely the python 32-bit and then we need to install the python 64-bit so that we can use the python 64-bit without getting any problems while executing the programs in python.

How do I change python to 64-bit?

If you have already installed the 32bit version and want to switch to 64bit version then simply uninstall the 32bit version first then install the 64bit version. Not sure if it was required but i also restarted the pc. Save this answer. Show activity on this post.


1 Answers

The answer is simple - it can't work. A process is either 32 or 64 bit, it's as simple as that. So if there is one module that can't run in 64 bit, one option besides re-compiling the module for 64 bit is to delegate whatever purpose it has to a second process running in 32 bit, just doing that. This might or might not be practical, depending on the actual task of the module.

like image 188
deets Avatar answered Nov 04 '22 06:11

deets