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

Import caffe error #5108

Closed
Arykelton opened this issue Dec 20, 2016 · 5 comments
Closed

Import caffe error #5108

Arykelton opened this issue Dec 20, 2016 · 5 comments
Labels

Comments

@Arykelton
Copy link

Error:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named caffe

I'm add export PYTHONPATH=/path/to/caffe-master/python:$PYTHONPATH in ~/.bashrc
I'm execute
make all
make test
make runtest
make pycaffe
make distribute

Using debian jessie, and I followed this tutorial.: https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide
Everything worked completely well during the installation but when I run a project that uses the import caffe this error happens. I've tried everything but nothing works, can anyone help me? Thank you in advance.
Already tried:
#720
#263
#4389

@williford
Copy link
Contributor

What does echo $PYTHONPATH print?

What happens when you go to /path/to/caffe-master/python and type python -c 'import caffe'?

You can also try dynamically adding the path (if the above works):

import os
import sys
caffe_root = os.environ['CAFFE_ROOT']
sys.path.insert(0, caffe_root + '/python')
import caffe

I'm marking this as closed, since it should have been sent to caffe-users mailing list instead or stackoverflow.

@Arykelton
Copy link
Author

Arykelton commented Dec 20, 2016

I got this error:
in
caffe_root = os.environ['CAFFE_ROOT']
File "/root/anaconda2/lib/python2.7/UserDict.py", line 40, in getitem
raise KeyError(key)
KeyError: 'CAFFE_ROOT'

echo PYTHONPATH result:
/path/to/caffe-master/python:/path/to/caffe-master/python: print

@williford
Copy link
Contributor

williford commented Dec 20, 2016

You need to define the environment variable CAFFE_ROOT or replace it with the path.

Please also answer my other questions, if you want assistance.

@Arykelton
Copy link
Author

Thaks williford
I'm define variable:
export CAFFE_ROOT=/path/to/caffe-master/python$CAFFE_ROOT in ~/.bashrc
Got this error:
in
import caffe
ImportError: No module named caffe

@williford
Copy link
Contributor

Ask on the Caffe user mailing list and I will answer you there. I don't want to keep spamming the BVLC core developers.

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

No branches or pull requests

2 participants