1.ImportError: No module named skimage.io
>>> import caffe
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “caffe/__init__.py”, line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File “caffe/pycaffe.py”, line 15, in <module>
import caffe.io
File “caffe/io.py”, line 2, in <module>
import skimage.io
ImportError: No module named skimage.io
Solution:
Lack of skimage toolbox
pip install scikit-image
2.ImportError: dynamic module does not define module export function (PyInit__caffe)
>>> import caffe
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
File “/home/wangxiao/Downloads/project/caffe-master/python/caffe/__init__.py”, line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
File “/home/wangxiao/Downloads/project/caffe-master/python/caffe/pycaffe.py”, line 13, in <module>
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: dynamic module does not define module export function (PyInit__caffe)
>>>
I found that Python 3.5 is the cause, because higher versions of Python and caffe are not necessarily compatible.
The official caffe website (http://caffe.berkeleyvision.org/) also suggests that caffe 2.7 is only better supported; for other versions, you need to figure it out yourself.
3.ImportError: No module named google.protobuf.internal
Solution:
sudo pip install protobuf
4.ImportError: No module named caffe
Solution: Add the python directory under the caffe directory to the environment variables
exportPYTHONPATH=/work/project/caffe/python:$PYTHONPATH