<div dir="ltr">Hi all,<div><br></div><div>While I realize that this is certainly tweaking multiprocessing beyond its specifications, I would like to use it on Windows to start a 32-bit Python process from a 64-bit Python process (use case: I need to interface with a 64-bit DLL and use an extension (pyFFTW) for which I can only find a 32-bit compiled version (yes, I could try to install MSVC and compile it myself but I'm trying to avoid that...))</div>
<div><br></div><div>In fact, this is "easy" to do by using multiprocessing.set_executable (...while that may not be its original role):</div><div><br></div><div><div>import multiprocessing as mp</div><div>import imp, site, sys</div>
<div>if "32" in sys.executable: # checking for my 32-bit Python install</div><div> del sys.path[1:] # recompute sys.path</div><div> print(sys.path)</div><div> site.main()</div><div> print(sys.path) # now points to the 32bit site-packages</div>
<div><br></div><div>import numpy</div><div><br></div><div>if __name__ == '__main__':</div><div> mp.set_executable(sys.executable.replace("33", "33-32")) # path of my 32-bit Python install</div>
<div> mp.Process(target=lambda: None).start()</div></div><div><br></div><div>The sys.path modifications are needed as otherwise the child process inherits the parent's sys.path and importing numpy (from the 64-bit path) fails as it is "not a valid Win32 application", complains Python (rightly).</div>
<div><br></div><div>However, even after the sys.path modifications, the numpy import fails with the error message (that I had never seen before):</div><div><br></div><div><sorry, I can't copy paste from the Windows command prompt...></div>
<div> from . import multiarray # <- numpy/core/__init__.py, line 5</div><div>SystemError: initialization of multiarray raised an unreported exception</div><div><br></div><div>Any hints as to how this could be fixed would be most welcome.</div>
<div><br></div><div>Thanks in advance,</div><div><br></div><div>Antony</div></div>