Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named pyopencl (Py2exe)

I am having some trouble with the PyOpenCL module when trying to make a .exe from Py2Exe. Py2Exe makes the .exe as it should do (No "ImportError: No module named pyopencl" here), but when I am running the .exe it says no module named pyopencl.

I am trying to make a .exe of the Phoenix Miner.

My setup.py:

from distutils.core import setup
import py2exe, sys, os, pyopencl

sys.argv.append('py2exe')

setup(
    options = {'py2exe': {'bundle_files': 1,
                          "includes":["pyopencl","twisted",
                                      "zope","QueueReader",
                                      "numpy"]}},
    console=[{'script' : 'phoenix.py'}],
    data_files=["C:\\Users\\Nicklas\\Desktop\\Phoenix-Miner\\kernels\\poclbm\\kernel.cl"],
    zipfile = None,
)

I found someone who had the same problem as me http://bytes.com/topic/python/answers/848048-py2exe-module-error but with no solution.

UPDATE: I found what was causing this error. In pyopencl __init__ there is a function called _find_pyopencl_include_path, it is quite self explanatory what it does. To make a long story short: the imp module fails to find the pyopencl module. To fix this I commented out that line and set pathname to the path to pyopencls include directory. Probably not a good fix. But it was an easy fix.

like image 321
Chengy Avatar asked Oct 06 '22 11:10

Chengy


1 Answers

I found what was causing this error. In pyopencl __init__ there is a function called _find_pyopencl_include_path, it is quite self explanatory what it does. To make a long story short: the imp module fails to find the pyopencl module. To fix this I commented out that line and set pathname to the path to pyopencls include directory. Probably not a good fix. But it was an easy fix.

like image 157
Chengy Avatar answered Oct 10 '22 02:10

Chengy