Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6404 Discussions

Caffe Import Error with fresh installed SDK (help) - NCSDK 1.09.00.04 - x86_64 - Ubuntu 16.04

idata
Employee
1,822 Views
"make examples" gives import errors with Caffe models while Tensorflow import works. Error Message mvNCCompile -w bvlc_googlenet.caffemodel -s 12 deploy.prototxt mvNCCompile v02.00, Copyright @ Movidius Ltd 2016 Caffe Import Error Configuration ----- NCSDK 1.09.00.04 Cloned ncsdk github from master commit 163be9b462411802fba2ea7be4e18759a7dd6c11 (grafted, HEAD -> master, origin/master, origin/HEAD) Author: Neal Smith <neal.p.smith@intel.com> Date: Tue Oct 24 10:16:04 2017 -0700 ----- Running Linux 16.04 on x86_64 Caffe automatically installed in /opt/movidius is branch fathom_branch commit eeebdab16155d34ff8f5f42137da7df4d1c7eab0
0 Kudos
24 Replies
idata
Employee
1,169 Views

@eruffaldi Hi. It looks like your python path environment variable isn't properly set. You can check this by typing in $echo $PYTHONPATH. You should be able to see a file path similar to /opt/movidius/caffe/python. Also make sure you are using the same account as the one you used to install the SDK. Let me know if this fixes your problem. Thanks.

0 Kudos
idata
Employee
1,169 Views

Just got the stick and had same problem I think they need to fix something!

0 Kudos
idata
Employee
1,169 Views

@Tome_at_Intel Already made sure the path in PYTHONPATH is included. Any other suggestions to fix this?

0 Kudos
idata
Employee
1,169 Views

@braca v1.09.00 requires PYTHONPATH to include /opt/movidius/mvnc/python as well. Please add export PYTHONPATH=/opt/movidius/caffe/python:/opt/movidius/mvnc/python:$PYTHONPATH to /etc/bash.bashrc, run source /etc/bash.bashrc and try again.

 

I was getting a similar error on my system, the above change fixed my issue. Your issue might not be the same as mine, but it's worth a shot.

0 Kudos
idata
Employee
1,169 Views

@AshwinVijayakumar Thanks a lot! Already tried and source with what you suggested and still same problem. This is what I did:

 

     

  1. Follow directions in https://developer.movidius.com/start until number 3.
  2.  

  3. Configure and source again the PYTHONPATH.
  4.  

  5. Get this error:
  6.  

 

Caffe Import Error

 

make[4]: Leaving directory '/home/luis/workspace/ncsdk/examples/caffe/GoogLeNet'

 

cp: cannot stat '../../caffe/GoogLeNet/graph': No such file or directory

 

Makefile:9: recipe for target 'googlenet' failed

 

make[3]: *** [googlenet] Error 1

 

make[3]: Leaving directory '/home/luis/workspace/ncsdk/examples/apps/multistick_cpp'

 

Makefile:12: recipe for target 'multistick_cpp/.' failed

 

make[2]: *** [multistick_cpp/.] Error 2

 

make[2]: Leaving directory '/home/luis/workspace/ncsdk/examples/apps'

 

Makefile:12: recipe for target 'apps/.' failed

 

make[1]: *** [apps/.] Error 2

 

make[1]: Leaving directory '/home/luis/workspace/ncsdk/examples'

 

Makefile:51: recipe for target 'examples' failed

 

make: *** [examples] Error 2

 

Thanks for any help look forward to testing the stick and make it work. I'm using Ubuntu 16.04

0 Kudos
idata
Employee
1,169 Views

@braca the error messages in https://ncsforum.movidius.com/discussion/comment/758/#Comment_758 is basically because make examples wasn't able to compile GoogLeNet (and other downloaded networks) into a graph file. cp: cannot stat '../../caffe/GoogLeNet/graph': No such file or directory explains the situation.

 

mvNCCompile isn't running because of the Caffe Import Error problem. I haven't come across this problem except when it was a PYTHONPATH issue, so we'll have to take some blind shots here :smile: .

 

     

  • Did you by any chance have an existing Caffe, OpenCV or Python installation?
  •  

  • Are you aware of any access permission changes w.r.t /opt/movidius/caffe/python or /opt/movidius/mvnc/python?
  •  

  • @pashmina.bendale tried a workaround on the previous SDK installation, this could be a good resource to help debug your issue - https://ncsforum.movidius.com/discussion/comment/527/#Comment_527
  •  

  • Have you tried installing on a fresh Ubuntu OS?
  •  

0 Kudos
idata
Employee
1,169 Views

@AshwinVijayakumar Thanks a lot! It's already working!!! I figured it was because I already have existing installations of caffe and opencv so it some how messes thing up. You might wanna add a comment somewhere to careful about it.

0 Kudos
idata
Employee
1,169 Views

I'm experiencing the same problem. Pretty Fresh Ubuntu installation (maybe 2 weeks old), no prior caffe installation. Tried everything mentioned in this thread. @braca how did you eventually get this fixed?

 

I have to say I've been fighting these scripts all day… Considering there is only one platform to support it seems a bit buggy.
0 Kudos
idata
Employee
1,169 Views

@Yakumo01 you are right. Even with a fresh installation of ubuntu got the same problem and still no idea how to fix it. It worked on my raspberry pi though, but I see errors with memory problems, alexnet is not loaded.

0 Kudos
idata
Employee
1,169 Views

@Yakumo01 What is the exact error that you get? Can you copy it here to see what's happening exactly and try to find the origin of your problem. Thanks

0 Kudos
idata
Employee
1,169 Views

Ok I eventually figured this out, but really I've spent many hours installing this SDK, fighting numerous script bugs (what's with the weird combination of sudo and non sudo calls in install?). Short version is import caffe would always fail due to scikit being missing. I needed to run:

 

sudo pip3 install scikit-image

 

And then everything was golden.

0 Kudos
idata
Employee
1,169 Views

@Yakumo01 Good that you fixed your problem. Tha main thing is to run installation only with "make install" on your user account without sudo. On some point install script may ask you for your password. Running installation as root fails and that was mentioned somewhere in thr forum.

 

I was thinking scikit-image package comes with 16.04 natively, not sure though.
0 Kudos
idata
Employee
1,169 Views

I am also running into the "caffe import error" issue described by @braca above.

 

When I first ran "make examples" after the ncsdk install, I got an error:

 

ModuleNotFoundError: No module named 'mvnc'

 

I don't have a directory /opt/movidius/mvnc/python. After searching for mvnc, I found it in /opt/movidius/NCSDK/ncsdk-x86_64/api/python, so I added that directory to PYTHONPATH

 

That resolved the error above and next I got this error:

 

ModuleNotFoundError: No module named 'graphviz'

 

I proceeded to install graphviz and that error went away and now I get the "Caffe Import error".

 

I am running Ubuntu 16/04 and am running all the steps in a fresh conda environment. I have also installed scikt-image in this environment as suggested above.

 

I would appreciate any help in resolving this error.

 

Thanks,

 

Ashutosh
0 Kudos
idata
Employee
1,169 Views

@ashutosh Maybe this discussion can be of some help to you

 

https://ncsforum.movidius.com/discussion/326/make-examples-error#latest
0 Kudos
idata
Employee
1,169 Views

Hi @georgievm_cms,

 

I have installed graphviz. I had originally installed it using pip3 and it is version 2.38.0 (confirmed by 'dot -V'). I also tried installing it via 'sudo apt-get install' and got the message that it was already installed.

 

So my error is exactly the one at the top of this thread:

 

Caffe Import Error

 

make[4]: Leaving directory '/home/luis/workspace/ncsdk/examples/caffe/GoogLeNet'

 

cp: cannot stat '../../caffe/GoogLeNet/graph': No such file or directory

 

Makefile:9: recipe for target 'googlenet' failed

 

make[3]: *** [googlenet] Error 1

 

make[3]: Leaving directory '/home/luis/workspace/ncsdk/examples/apps/multistick_cpp'

 

Makefile:12: recipe for target 'multistick_cpp/.' failed

 

make[2]: *** [multistick_cpp/.] Error 2

 

make[2]: Leaving directory '/home/luis/workspace/ncsdk/examples/apps'

 

Makefile:12: recipe for target 'apps/.' failed

 

make[1]: *** [apps/.] Error 2

 

make[1]: Leaving directory '/home/luis/workspace/ncsdk/examples'

 

Makefile:51: recipe for target 'examples' failed

 

make: *** [examples] Error 2

 

From what I am seeing there is a general pattern to the errors people are seeing with Ubuntu 16.04:

 

     

  • not finding mvnc (which is resolved by updating PYTHONPATH)
  •  

  • not finding graphviz (which is resolved by installing it)

     

    which leaves the "Caffe Import Error".
  •  

 

Any chance you can provide a docker image of a working install that we can run?

 

Thanks,

 

Ashutosh
0 Kudos
idata
Employee
1,169 Views

I was looking in my install logs and even though it says "Setup is complete", there are errors in the "make install" step.

 

I made sure I have libtiff5, opencv and libboost-python installed, but that has not resolved these errors.

 

So I think this is the real issue:

 

[ 75%] Linking CXX executable compute_image_mean

 

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TI FFReadRGBAStrip@LIBTIFF_4.0' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyUnicodeUCS4_FromEncodedObject'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyNumber_InPlaceDivide' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyString_Size'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyString_FromStringAndSize' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTI

 

FFIsTiled@LIBTIFF_4.0'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyString_InternFromString' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyInt_AsLong'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyUnicodeUCS4_AsWideChar' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTI

 

FFWriteScanline@LIBTIFF_4.0'

 

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TI FFGetField@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTI

 

FFScanlineSize@LIBTIFF_4.0'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyString_AsString' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTI

 

FFReadEncodedTile@LIBTIFF_4.0'

 

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TI FFReadRGBATile@LIBTIFF_4.0' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyString_FromFormat'

 

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TI FFClose@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTI

 

FFRGBAImageOK@LIBTIFF_4.0'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyClass_Type' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyString_FromString'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyFile_AsFile' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPy_InitModule4_64'

 

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TI FFOpen@LIBTIFF_4.0' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyInt_Type'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyInt_FromLong' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyFile_FromString'

 

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TI FFReadEncodedStrip@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTI

 

FFSetField@LIBTIFF_4.0'

 

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un

 

defined reference to PyNumber_Divide' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: un defined reference toPyString_Type'

 

/usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference to TI FFSetWarningHandler@LIBTIFF_4.0' /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9: undefined reference toTI

 

FFSetErrorHandler@LIBTIFF_4.0'

 

collect2: error: ld returned 1 exit status

 

tools/CMakeFiles/compute_image_mean.dir/build.make:130: recipe for target 'tools

 

/compute_image_mean' failed

 

make[3]: *** [tools/compute_image_mean] Error 1

 

make[3]: Leaving directory '/opt/movidius/bvlc-caffe/build'

 

CMakeFiles/Makefile2:467: recipe for target 'tools/CMakeFiles/compute_image_mean

 

.dir/all' failed

 

make[2]: *** [tools/CMakeFiles/compute_image_mean.dir/all] Error 2

 

make[2]: Leaving directory '/opt/movidius/bvlc-caffe/build'

 

Makefile:127: recipe for target 'all' failed

 

make[1]: *** [all] Error 2
0 Kudos
idata
Employee
1,169 Views

@ashutosh

 

same issue

 

I failed at this step

 

[ 75%] Linking CXX executable compute_image_mean

 

and when I run make examples, I got caffe import error…
0 Kudos
idata
Employee
1,169 Views

The message

 

[ 75%] Linking CXX executable compute_image_mean

 

shows that Caffe is not compiling properly so it is normal that "Caffe Import" will not pass later.

 

Can you check please what's inside

 

/usr/lib/x86_64-linux-gnu directory

 

because this error origins from missing or dependency not meeting libboost_python.so
0 Kudos
idata
Employee
1,169 Views

[ 75%] Linking CXX executable compute_image_mean

 

it's something wrong with caffe. try to build caffe by yourself. see the below links.

 

in my side, it's something wrong with opencv, I build and install opencv from source with -D BUILD_TIFF=ON

 

then it works fine

 

https://groups.google.com/forum/#!searchin/caffe-users/LIBTIFF_4.0|sort:date/caffe-users/wKYe45FKSqE/fWM6Yfo3LzkJ

 

http://blog.csdn.net/ccemmawatson/article/details/42004105
0 Kudos
idata
Employee
962 Views

Thanks, I will build opencv from source and try again.

0 Kudos
Reply