2

Everyday I install caffe, it works, then I restart my the system and I get the error :

ImportError: No module named caffe

So I fix it by

import sys

sys.path.append('/home/shubham/caffe/python')

And everything works (only until I exit my ipython) no matter what my env variables are upto.

On checking my env variables CAFFE_ROOT & PYTHONPATH are always stuck to this directory: /home/shubham/Desktop/dir/vgg_face_caffe/ no matter how much I change them. Although python always seems to work even with the PYTHONPATH set to a directory where there is no python installation at all.

My questions are :

How do I fix up the caffe path so I don't get the import module error ? Why do the environment variables not making sense ? That is, how is python working with the wrong PYTHONPATH path and yet caffe doesn't work when I set the right path ? And why do they keep changing by itself ?

I am on ubuntu 16.04

Thank you for reading !

EDIT: just realized PYTHONPATH and CAFE_ROOT are always same as the directory in I am in. Still need help.

1 Answer 1

2

Amazing! Couldn't figure it out for days but 20mins after posting here, my brain works.

My ~/.profile was a mess. the CAFFEROOT env variable was set to $(pwd) and hence PYTHONPATH to $(pwd)/python .

Also, this answer helped me figure out the mess about having to bash profiles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.