1

I installed caffe from source code on my Mac os x, but when I type this command:

python -c "import caffe"

I got this error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/__init__.py", line 1, in <module>
    from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver
  File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/pycaffe.py", line 15, in <module>
    import caffe.io
  File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/io.py", line 8, in <module>
    from caffe.proto import caffe_pb2
  File "/Users/junhao.wen/Hao/Docker/Caffe/Caffe_source/caffe/python/caffe/proto/caffe_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/descriptor.py", line 46, in <module>
    from google.protobuf.pyext import _message
ImportError: dlopen(/Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so, 2): Symbol not found: __ZNK6google8protobuf10TextFormat17FieldValuePrinter10PrintBytesERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
  Referenced from: /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so
  Expected in: flat namespace
 in /Users/junhao.wen/anaconda2/lib/python2.7/site-packages/protobuf-3.1.0-py2.7-macosx-10.6-x86_64.egg/google/protobuf/pyext/_message.so

Any suggestion will be appreciated:) Thanks in advance

Ulas Keles
  • 1,681
  • 16
  • 20
Junhao Wen
  • 31
  • 2
  • 6
  • please format your question – Shai Oct 19 '16 at 21:18
  • have you iinstalled and compiled all prerequisites? specifically protobuf? – Shai Oct 19 '16 at 21:19
  • Yes, I have compiled them, but I think maybe because when I install the python dependencies, I can not install leveldb with my anaconda pip, but i do have leveldb with brew, here is the error: cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future error: command 'gcc' failed with exit status 1 – Junhao Wen Oct 20 '16 at 05:33
  • I dont know how to format my question, it said that comment only edit in five minutes, this is really complicated – Junhao Wen Oct 20 '16 at 05:43
  • see [these instructions](http://stackoverflow.com/editing-help) – Shai Oct 20 '16 at 05:45
  • What is your PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION environment variable set to if it is set to anything? – Ulas Keles Jan 24 '17 at 21:08

1 Answers1

0

Make sure that the Python path is pointing to $CAFFE_HOME/Python

Rahila T - Intel
  • 832
  • 4
  • 11