[英]Installing gdal python library on windows using conda (DLL load failed)
[英]Installing Theano on Windows - DLL load failed
我想在Windwos 8上安裝Theano
遵循了這些步驟。
我嘗試使用測試:
import numpy as np
import time
import theano
print('blas.ldflags=', theano.config.blas.ldflags)
A = np.random.rand(1000, 10000).astype(theano.config.floatX)
B = np.random.rand(10000, 1000).astype(theano.config.floatX)
np_start = time.time()
AB = A.dot(B)
np_end = time.time()
X, Y = theano.tensor.matrices('XY')
mf = theano.function([X, Y], X.dot(Y))
t_start = time.time()
tAB = mf(A, B)
t_end = time.time()
print("NP time: %f[s], theano time: %f[s] (times should be close when run on CPU!)" % (
np_end - np_start, t_end - t_start))
print("Result difference: %f" % (np.abs(AB - tAB).max(), ))
我知道該腳本是numpy和theano計算時間之間的比較。
但不知何故,找不到一些dll。 Pl找到以下日志:
[Py341] C:\>python ML\Deep\TheanoSetupTesting.py
blas.ldflags= -LE:\Things_Installed_Here\Theano\openblas -lopenblas
Traceback (most recent call last):
File "ML\Deep\TheanoSetupTesting.py", line 12, in <module>
mf = theano.function([X, Y], X.dot(Y))
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\function.py", line 317, in function
output_keys=output_keys)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\pfunc.py", line 526, in pfunc
output_keys=output_keys)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\function_module.py", line 1778, in orig_function
defaults)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\compile\function_module.py", line 1642, in create input_storage=input_storage_lists, storage_map=storage_map)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\link.py", line 690, in make_thunk
storage_map=storage_map)[:3]
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\vm.py", line 1037, in make_all
no_recycling))
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\op.py", line 932, in make_thunk
no_recycling)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\op.py", line 850, in make_c_thunk
output_storage=node_output_storage)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1207, in make_thunk
keep_lock=keep_lock)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1152, in __compile__
keep_lock=keep_lock)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1602, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cmodule.py", line 1174, in module_from_key module = lnk.compile_cmodule(location)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cc.py", line 1513, in compile_cmodule
preargs=preargs)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cmodule.py", line 2196, in compile_str
return dlimport(lib_filename)
File "E:\Things_Installed_Here\Anaconda_Py\envs\Py341\lib\site-packages\theano-0.7.0-py3.4.egg\theano\gof\cmodule.py", line 331, in dlimport
rval = __import__(module_name, {}, {}, [module_name])
ImportError: DLL load failed: The specified module could not be found.
作為python世界的新手,我無法找到未找到的Dll。 如果丟失我會安裝它,並將添加系統路徑變量的路徑。 但是我怎么知道它是哪個dll。 我嘗試使用pdb
並在cmodule.py
中的不同位置設置斷點,但沒有一個被擊中。
theano
走一條完全不同的道路。 我發現了一些帖子,建議微軟編譯器工作得很好。 但是我已經連續14個小時以來一直在討論一個問題,並且想要一種有效的方法。 最終我想在我的系統上使用theano
。 順便說一下,沒有CUDA
。 我只在嘗試CPU。
這可能有點晚了。 我按照與你完全相同的指南,遇到了同樣的錯誤。
原來可以通過將openblas目錄添加到系統路徑來修復它。 在您的示例中,將“E:\\ Things_Installed_Here \\ Theano \\ openblas”添加到系統路徑變量。
請注意,根據放置DLL文件的位置,您需要添加“E:\\ Things_Installed_Here \\ Theano \\ openblas”或“E:\\ Things_Installed_Here \\ Theano \\ openblas \\ bin”。
Windows 10 64位,Python 3.5.1(Anaconda 2.5),Theano 0.8.2。
對於那些需要它的人,我可以在Windows 10中安裝Theano,這要歸功於這三個指南guide1 , guide2和OP附帶的指南。
好吧,我終於找到了至少使用WinPython,python3.5.1.1,Win 7 64bit和mingw64進行安裝的原因:
在.theanorc [.txt]文件中,我在安裝blas之后,使用包含openblas include路徑的一行[blas]。 我刪除了該行並將[blas]下面的區域留空了。 重新啟動WinPython / Spider,打開一個新的控制台,它工作正常。
之后,Testet使用Theano從Lasagne運行mnist.py。
我也在努力讓theano在Windows 10 x64上工作,在閱讀了幾個幫助指南之后,最終對我有用的是:
conda install mingw libpython
pip install theano
將以下內容放在.theanorc.txt中:
[global] floatX = float32 device = cpu [blas] ldflags = -LC:\\\\openblas\\\\bin -LC:\\\\openblas\\\\lib -lopenblas
希望這有助於某人。
只是為了增加我對Win10 64bit和theano(和keras)的體驗。 我也得到了DLL加載失敗錯誤。 嘗試了我在theano win安裝網頁和不同論壇和博客帖子中找到的所有內容(在Uradium的帖子中提到)。
它不適合我,但這是有效的:
我安裝了TDM-GCC-64和openblas,使用regedit我已經將他們的/ bin目錄添加到PATH(以及openblas的/ lib目錄)
在miniconda3下制作干凈的venv - 為theano和keras安裝先決條件(scipy,numpy,pyyaml),python 3.5.2
conda install mingw libpython
conda install theano
(安裝所有mingw庫)
在這一點 - 它工作 - 所以我沒有使用任何.theanorc.txt
文件配置,沒有擺弄Windows環境變量。 它甚至適用於基於keras的python腳本,甚至 - 雖然我沒有安裝keras到我的conda venv它正在工作...(我已經安裝在我的“普通”非conda python3中,后來我在下面安裝了keras我的conda venv也是如此)。
很晚,但供將來參考。 我偶然發現這個線程試圖在CPU上運行OpenBLAS測試腳本。 它在GPU上運行良好,但CPU給我的錯誤與OP相同。 我在這里嘗試了這些建議,但那沒有用。 結果證明.theanorc中的一行:
ldflags=-LE:\OpenBLAS-v0.2.14-Win64-int32/bin -lopenblas
不應該在bin之后和-l之前有空格。 所以它應該是:
ldflags=-LE:\OpenBLAS-v0.2.14-Win64-int32/bin-lopenblas
現在一切正常。 嘗試過:
Windows 10
Python 3.5
Theano 0.9
Cuda 8 (with CudaMEM and CudaDNN)
Visual Studio 2015 Community
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.