torch / distro

Torch installation in a self-contained folder
BSD 3-Clause "New" or "Revised" License
555 stars 481 forks source link

'image' module error using from python #193

Open wakanawakana opened 7 years ago

wakanawakana commented 7 years ago

Hello Contributors (^^)/

I build Windows7 64bit With Cuda8, VS2015Com and CUDNN5(problem modifyd[DOS Prompt not equal ANSI Color Console & CUDNN problem #188]) Using the image module from the Torch/Lua console was okay But, I want use from python (I try pip install lutorpy but not work)

My Python environment was Anaconda2 with many modules I will put on the code I am trying

python code(calllua.py)

import ctypes
import ctypes.util

liblua = ctypes.CDLL("C:/Users/wakana/mLearn/Torch7/distro-win/install/bin/lua51.dll")
L = liblua.luaL_newstate()
liblua.luaL_openlibs(L)
liblua.luaL_loadfile(L, "C:/Users/wakana/mLearn/Torch7/model/run_modul.lua")
liblua.lua_call(L, 0, 0)

run_modul.lua

require 'torch'
require 'image'
XXX= require 'XXXX'

torch.test()
image.test()
 ・
 ・

Call from python logs

C:\Users\wakana\mLearn\Torch7\model>python calllua.py
Found Environment variable CUDNN_PATH = C:\Program Files\NVIDIA GPU Computing To
olkit\CUDA\v8.0\bin\cudnn64_5.dll
seed:   1483774506
Running 40 tests
 1/40 gaussianpyramid ................................................... [WAIT]
 1/40 gaussianpyramid ................................................... [PASS]

 2/40 rgb2hsv ........................................................... [WAIT]
 2/40 rgb2hsv ........................................................... [PASS]

 3/40 CompressAndDecompress ............................................. [WAIT]
 3/40 CompressAndDecompress ............................................. [PASS]

 4/40 rgb2labByteTensor ................................................. [WAIT]
 4/40 rgb2labByteTensor ................................................. [PASS]

 5/40 rgb2hslByteTensor ................................................. [WAIT]
 5/40 rgb2hslByteTensor ................................................. [PASS]

 6/40 gaussian .......................................................... [WAIT]
 6/40 gaussian .......................................................... [PASS]

 7/40 bicubicUpscale_ByteTensor ......................................... [WAIT]
 7/40 bicubicUpscale_ByteTensor ......................................... [PASS]

 8/40 test_transformation_largeByteImage_vflip .......................... [WAIT]
 8/40 test_transformation_largeByteImage_vflip .......................... [PASS]

 9/40 test_pbmload ...................................................... [WAIT]
 9/40 test_pbmload ...................................................... [PASS]

10/40 bicubicUpscale .................................................... [WAIT]
10/40 bicubicUpscale .................................................... [PASS]

11/40 FlipAgainstHFlip .................................................. [WAIT]
11/40 FlipAgainstHFlip .................................................. [PASS]

12/40 toFromByteTensor .................................................. [WAIT]
12/40 toFromByteTensor .................................................. [PASS]

13/40 test_hflip_simple ................................................. [WAIT]
13/40 test_hflip_simple ................................................. [PASS]

14/40 test_vflip_simple ................................................. [WAIT]
14/40 test_vflip_simple ................................................. [PASS]

15/40 bilinearUpscale_ByteTensor ........................................ [WAIT]
15/40 bilinearUpscale_ByteTensor ........................................ [PASS]

16/40 bicubicDownscale .................................................. [WAIT]
16/40 bicubicDownscale .................................................. [PASS]

17/40 DecompressPNG ..................................................... [WAIT]

C:\Users\wakana\mLearn\Torch7\model>

png image test fail and shutdown python

Maybe Windows Environment problem? but i have no ideas

wakanawakana commented 7 years ago

Add Info

python Another way

import os os.system("th run_module.lua")

not work There is something that can not coexist

wakanawakana commented 7 years ago

I understood one problem lua environment package.cpath, package.path

Adding the th.bat parameter to torch - activate.cmd will solve the problem that the module can not be found

wakanawakana commented 7 years ago

Add Info

python Another way

subprocess.call("C:\Users\wakana\mLearn\Torch7\distro-win\install\torch-activate.cmd & th run_module.lua", shell=True)

success