I could not find a bugtracker, so I'm posting this patch on this mailing list.

PyCuda had problems finding its header files using Python 2.6 on Windows. This
is because it is installed in Lib\site-packages\pycuda, while the header files
reside in Include\pycuda. To solve this, I replaced _find_pycuda_include_path()
in compiler.py with the attached code


Best regards,
Bryan


def _find_pycuda_include_path():
    from imp import find_module
    file, pathname, descr = find_module("pycuda")

    from os.path import join, exists
    installed_path = join(pathname, "..", "include", "pycuda")
    installed_path2 = join(pathname, "..", '..', '..', "include", "pycuda")
    
    development_path = join(pathname, "..", "src", "cuda")
    development_path2 = join(pathname, "..", "..", "..", "src", "cuda")

    import sys
    usr_path = "/usr/include/pycuda"
    usr_local_path = "/usr/local/include/pycuda"
    prefix_path = join(sys.prefix, "include" , "pycuda")

    if exists(installed_path):
        return installed_path
    elif exists(installed_path2):
        return installed_path2
    elif exists(development_path):
        return development_path
    elif exists(development_path2):
        return development_path2
    else:
        if sys.platform == "linux2":
            if exists(prefix_path):
                return prefix_path
            elif exists(usr_path):
                return usr_path
            elif exists(usr_local_path):
                return usr_local_path

        raise RuntimeError("could not find path to PyCUDA's C header files")



_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to