2
votes

I'm trying to run Caffe in it's Python interface. I've already run the command make pycaffe in the caffe directory and it worked fine. Now, when I run the command import caffe in the python environment in the terminal (Ubuntu 14.04), I'm getting the following error:

    >>> import caffe
    Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/home/pras/caffe/python/caffe/__init__.py", line 1, in <module>
      from .pycaffe import Net, SGDSolver
     File "/home/pras/caffe/python/caffe/pycaffe.py", line 11, in <module>
      import caffe.io
    ImportError: No module named io

I tried to search my computer for 'caffe.io' but couldn't find any file by that name. Any idea why this error is occurring and how to correct it?

1
you need to look for file io.py in caffe folder - Shai
Thanks Shai. Found the file in caffe folder and it seems to be working now! - Dr. Prasanna Date
I'm having issues with creating a LMDB data file to be run with Caffe though. Here is the link to the question. Please have a look. - Dr. Prasanna Date

1 Answers

6
votes

You need to add Python Caffe to PYTHONPATH. In your case:
export PYTHONPATH=$PYTHONPATH:/home/pras/caffe/python