(Install Problems) There Is No Module Named Caffe

838 views
Skip to first unread message

Christopher Menart

unread,
Jan 27, 2017, 11:51:20 AM1/27/17
to Caffe Users
I installed on Ubuntu 16.04 using the install instructions (https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-Installation-Guide) and following them pretty closely. I did a CPU_ONLY build, since I'm running Ubuntu as virtual machine, and used python 2.7.

My bashrc adds to PYTHONPATH like so:

export PYTHONPATH=/deeplearning/caffe/python:$PYTHONPATH

I have also tried /deeplearning/caffe/distribute/python.

There were no error message when compiling. 'make pycaffe' now just reports 'make: Nothing to be done for 'pycaffe''. Indeed, if I navigate to caffe/python/caffe, I see '_caffe.so', which all seems to indicate that I haven't made the mistakes seen on StackExchange (that I could find) and that pycaffe actually built. There's an __init__.py in there too.

Yet if I launch python and try 'import caffe' or 'import _caffe', python only regards me with a look of incredulous suspicion.

It says I am a fool. There IS no module named caffe. Perhaps there never was. Did I only dream of it? The days do blur together now; yet I was told once that I could run neural networks out of python. Should you be my light, shining through the shell, my gratitude will be as eternal as it is ephemeral.

Christopher Menart

unread,
Jan 27, 2017, 1:40:23 PM1/27/17
to Caffe Users
If it helps any, I've found there seems to be something weird about by numpy installation. The path I added to Makefile.config doesn't actually seem to point to anything after I upgraded numpy upon getting an error from trying to import it....the way to install numpy on a new Ubuntu install, as given in the instructions, doesn't appear to be right, does anyone understand how to work around that?

Nathan Ing

unread,
Jan 28, 2017, 11:50:32 AM1/28/17
to Caffe Users
Have you tried using the sys module and inserting caffe python location directly, like they do in the tutorial scripts?

import sys
sys.path.insert(0, '/caffe/path/python')

?

Christopher Menart

unread,
Jan 28, 2017, 1:14:18 PM1/28/17
to Caffe Users
Hi, thanks for taking the time to answer. I've just tried that now. The result is the same--still no named module. In fact, if I just use print(sys.path), I can see that the path is already there whenever I boot python.

Christopher Menart

unread,
Jan 30, 2017, 1:41:51 PM1/30/17
to Caffe Users
As an update, I have done my 6th install of Ubuntu, once again going over the instructions meticulously. I am adding 'sudo' to some instructions that don't execute without it, such as the installing of requirements for pycaffe. Numpy now imports without any problems, but again, even though my python path appears to be correctly set ('~/caffe-master/python') and the _so file exists, python insists that there is no module named caffe.
Reply all
Reply to author
Forward
0 new messages