CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

Import cntk modul in python - Linux

Open Arminea opened this issue 9 years ago • 4 comments

Hi, I'm trying to load cntk module from my python code. Examples run ok. Cntk is activated. Error is on import line from cntk.ops.functions import load_model Error message is ImportError: No module named 'cntk'

Thanks for answering Tereza

Arminea avatar Jan 13 '17 12:01 Arminea

assuming you are able to import CNTK - import CNTK. Could you please try from cntk.ops import load_model

sayanpa avatar Jan 13 '17 21:01 sayanpa

I followed this instructions https://github.com/Microsoft/CNTK/wiki/Setup-Linux-Binary-Script and everything was fine, including an example from Tutorials.

My cgi script:

#!/usr/bin/python3

import cgi
import cntk
from cntk.ops import load_model

print("Content-type: text/html\n\n")
print("hi there")

When I try to run it ( python3 my_file.py ) I get this message

import cntk
ImportError: No module named cntk

Arminea avatar Jan 15 '17 10:01 Arminea

Maybe it's permission thing. I'll check this out.

Arminea avatar Jan 15 '17 11:01 Arminea

@sayanpa Hi, I know where is the problem. It's something about running python script via CGI. Maybe you could help me with something else. I tried to run my python script on my home computer with windows. Import is correct but there is a problem with loading a model. I found the similar issue here https://github.com/Microsoft/CNTK/issues/1179.

Error message is Value error: The convolution map should have at least as many axes as the shape of the input it operates on. Input is image 256x256x3. It's weird that the same error appeared in c++ code of @dmagee too.

Arminea avatar Jan 17 '17 09:01 Arminea