2012-07-16 231 views
0

我很難安裝pycuda。我在Ubuntu 12.04上運行。我首先安裝了Enthought python發行版(儘管我已經在電腦上安裝了python)。我將enthought python位置添加到我的.profile中的路徑中(並且此工作沒有問題,從命令行鍵入python或ipython正確使用enthought版本)。然後我遵循http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu的指示(跳過步驟0-1,因爲我已經安裝了numpy和cuda)。在Ubuntu上安裝Pycuda

一切似乎運行並安裝正常。但是當我嘗試使用pycuda時,它失敗了。例如,這裏是當我嘗試運行hello_gpu.py例子會發生什麼:

:~/Downloads/pycuda-2012.1$ python examples/hello_gpu.py 
Traceback (most recent call last): 
    File "examples/hello_gpu.py", line 1, in <module> 
    import pycuda.driver as drv 
    File "/usr/lib/python_enthought/lib/python2.7/site-packages/pycuda-2012.1-py2.7-linux-  x86_64.egg/pycuda/driver.py", line 2, in <module> 
    from pycuda._driver import * 
ImportError: /usr/lib/libboost_python-py27.so.1.46.1: undefined symbol:   
PyUnicodeUCS4_FromEncodedObject 

或者,當我嘗試從空閒導入pycuda包,我得到一個不同的錯誤:

Python 2.7.3 |EPD 7.3-1 (64-bit)| (default, Apr 11 2012, 17:52:16) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 
Type "credits", "demo" or "enthought" for more information. 
>>> import pycuda 
>>> pycuda 
<module 'pycuda' from 'pycuda/__init__.pyc'> 
>>> import pycuda.driver as drv 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "pycuda/driver.py", line 2, in <module> 
    from pycuda._driver import * 
ImportError: No module named _driver 

我懷疑問題的一部分是我沒有指定Python解釋器的正確路徑,但我無法弄清楚這個錯誤發生的地方。任何建議將是最受歡迎的,我沒有想法。

+0

如果PyCUDA存在錯誤,您可以考慮其他選項,例如我正在處理的ArrayFire Python。它是Python最廣泛的GPU庫,在這裏:http://www.accelereyes.com/arrayfire/python/ – arrayfire 2012-07-17 00:51:40

+0

謝謝,雖然因爲我有一堆已經寫入pycuda的代碼,現在切換是一件遺憾的事情... – miz 2012-07-17 01:48:29

+0

@miz:看起來你已經混合了Enthought Python發行版和Ubuntu標準系統Python。您不能將爲系統Python構建的二進制庫與Enthought(使用intel編譯器構建,而不是gcc)混合。你必須使用100%System或100%Enthough(後者可能意味着再次構建你自己的booth-python版本,如果可能的話)。 – talonmies 2012-07-17 08:09:15

回答

0

此問題似乎是由同一系統上兩種不同Python安裝之間的衝突引起的。 OP顯然通過卸載一個完整的Python安裝並僅使用系統Python安裝來解決此問題。建議使用非系統Python安裝解決此問題的方式很可能有其他方法here

[此答案從評論中彙總並作爲社區wiki條目添加,希望它會收到投票並從中刪除PyCUDA標籤的未答覆列表]