lmb-freiburg / flownet2

FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks
https://lmb.informatik.uni-freiburg.de/Publications/2017/IMKDB17/
Other
1k stars 318 forks source link

importError: failed to import enum_type_wrapper #142

Closed buemi closed 6 years ago

buemi commented 6 years ago

Hi, I receive the following error when I execute the run-flownet script:

_flownet2/python/caffe/proto/caffe_pb2.py", line 6, in from google.protobuf.internal import enum_typewrapper ImportError: No module named google.protobuf.internal

Any idea?

nikolausmayer commented 6 years ago

Try installing libprotobuf-dev, protobuf-compiler and python-protobuf if they are not already installed.

buemi commented 6 years ago

Yes, all the packages are installed, but the error persists.

nikolausmayer commented 6 years ago

Ok, if those packages are installed, then your $PYTHONPATH might not include the path to the module.

buemi commented 6 years ago

It's quite strange:

$ echo $PYTHONPATH /home/buemi/home/buemi/Antonio/flownet2/python/caffe/python:/usr/local/lib/python2.7/dist-packages/pip:

There is a double home location in the path! Which is the script where I have to look in order to correct it?

nikolausmayer commented 6 years ago

Hm, there is this line in set-env.sh: CAFFE_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Maybe this is misbehaving?

buemi commented 6 years ago

But what is the correct caffe path? I found several "caffe" folders:

but noone has a subfolder named "python"

nikolausmayer commented 6 years ago

It should be flownet2/python. The caffe within that folder is the module loaded by import caffe in Python.

buemi commented 6 years ago

"import caffe" provides the original error: _>>> import caffe Traceback (most recent call last): File "", line 1, in File "/home/buemi/Antonio/flownet2/python/caffe/init.py", line 1, in from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver File "/home/buemi/Antonio/flownet2/python/caffe/pycaffe.py", line 15, in import caffe.io File "/home/buemi/Antonio/flownet2/python/caffe/io.py", line 8, in from caffe.proto import caffe_pb2 File "/home/buemi/Antonio/flownet2/python/caffe/proto/caffe_pb2.py", line 6, in from google.protobuf.internal import enum_typewrapper ImportError: No module named google.protobuf.internal

Have I to set the protobuf path somewhere?

nikolausmayer commented 6 years ago

Depends — what is the location of your protobuf (locate google/protobuf/internal/__init__)?

buemi commented 6 years ago

It seems to be here: /usr/local/lib/python2.7/dist-packages/google/protobuf/internal/init.py /usr/local/lib/python2.7/dist-packages/google/protobuf/internal/init.pyc

nikolausmayer commented 6 years ago

I see. Well, since your $PYTHONPATH only contains /usr/local/lib/python2.7/dist-packages/pip, I'd try adding /usr/local/lib/python2.7/dist-packages to it ;)

buemi commented 6 years ago

It seems I solved by installing protobuf locally. Thanx

nikolausmayer commented 6 years ago

Fair enough :grin: