Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script can't import caffe, can import fine from Python command line #2911

Closed
jfrench206 opened this issue Aug 12, 2015 · 4 comments
Closed

Comments

@jfrench206
Copy link

Hey folks, I'm having an issue that seems similar to #263 but not the same. I seem to have successfully made pycaffe - I have a _caffe.so file in /caffe/python/caffe/ - and have added both these lines to my .bashrc file:

export CAFFE_ROOT=${HOME}/deep-dream/caffe
export PYTHONPATH=${HOME}/deep-dream/caffe/python:$PYTHONPATH

When I run Python, and type "import caffe" from inside the interpreter I get no errors.

However, when I run the batcountry demo ("python demo.py" with some misc. flags) from shell command prompt, I get this error:

Traceback (most recent call last):
File "demo.py", line 7, in
from batcountry import BatCountry
File "/usr/local/lib/python2.7/dist-packages/batcountry/init.py", line 4, in
from batcountry import BatCountry
File "/usr/local/lib/python2.7/dist-packages/batcountry/batcountry.py", line 8, in
import caffe
ImportError: No module named caffe

Any clues?

@seanbell
Copy link

Does the demo modify the python path? Modify the script to print out the python path just before importing caffe:

import sys
print sys.path 

@longjon
Copy link
Contributor

longjon commented Aug 16, 2015

Closing as this looks like a usage issue/request for help; as @seanbell mentions, this is almost certainly a PYTHONPATH issue downstream of Caffe.

This tracker is reserved for specific Caffe development issues and bugs; you're welcome to continue the discussion on the caffe-users list.

For more information, see our contributing guide.

Thanks!

@longjon longjon closed this as completed Aug 16, 2015
@cervantes-loves-ai
Copy link

i have also similar problem... can anyone solve it

(venv)ibrhaim@ibrhaim-B85M-D3H:~/digits/digits$ ./digits-devserver
cudaRuntimeGetVersion() failed with error #38
Did you forget to "make pycaffe"?
Traceback (most recent call last):
File "./digits-devserver", line 42, in
config.load_config('quiet')
File "/home/ibrhaim/digits/digits/digits/config/load.py", line 147, in load_config
option.apply()
File "/home/ibrhaim/digits/digits/digits/config/caffe_option.py", line 243, in apply
import caffe
File "/home/ibrhaim/caffe/python/caffe/init.py", line 1, in
from .pycaffe import Net, SGDSolver
File "/home/ibrhaim/caffe/python/caffe/pycaffe.py", line 14, in
import caffe.io
File "/home/ibrhaim/caffe/python/caffe/io.py", line 2, in
import skimage.io
ImportError: No module named skimage.io

@duygusar
Copy link

Same exact problem, I can import in Python but when I run the script it can't find the module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants