These last few days I have been busy trying to install PyCuda for Windows, but Windows sucks a bit in these things, so it took quite a bit of time. This is a post documenting my Odyssey.

First of all, I had no luck at all with Python 2.6. After two days I got it to compile, but it couldn’t load the module, so I installed 2.5 again. You absolutely need Visual Studio 2003 because I couldn’t get either MinGW or the VC** Toolkit to work in compiling.

The first step is to get the Boost sources (not binaries) and build them with bjam with this command line:

bjam.exe --toolset=msvc-7.1 --build-type=complete stage

This will take a while, so relax. You basically need two or three files, boost_python-something and boost_thread-something, so you can start the next step as soon as these are done. I did not mess with trying to get it to compile only these.

After this is done, you should have a “stage” dir in the main boost source dir. Get PyCuda 0.93 beta (0.92 didn’t work), and use this siteconf.py file in the PyCuda dir:

BOOST_INC_DIR = ['C:\boost_1_38_0']
BOOST_LIB_DIR = ['C:\boost_1_38_0\stage\lib']
BOOST_PYTHON_LIBNAME = ['libboost_python-mgw34']
BOOST_THREAD_LIBNAME = ['libboost_thread-mgw34-mt']
CUDA_ROOT = 'C:\CUDA'
CUDADRV_LIB_DIR = ['C:\CUDA\lib']
CUDADRV_LIBNAME = ['cuda']
CXXFLAGS = []
LDFLAGS = []

Obviously, you should change the paths to whatever you have. Do a “python setup.py build” in the PyCuda dir and it should build the files. Install them with “python setup.py install” as usual, and everything should be fine. If it complains about cl.exe when trying to run your script, make sure the VS2003 environment variables are set (run the bat file MS gives you).

I’m pretty sure I’ve missed a step, because this thing took me three or four days of puzzling out and sleeping at 6 am. I hope it is of use to anyone (or me, in the future), that my toil may not go in vain.

EDIT: Oh, hey, actually, you know what? Here you go. Just have the binary. On me, no worries. Put the boost_python-vc71-mt-1_38.dll somewhere in your path and you’re good to go.