frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

ModuleNotFoundError: No module named 'mvnc'

Hello, I recently received the NCS, I installed it on Ubuntu 16.04LTS and Raspberry Pi 3B Stretch

For the Ubuntu 16.04 example build, I got the following error when compiling GoogleNet, I disabled virtual environment in this example, but I get the same error with the virtual environment:

GoogLeNet$ make compile

making prereqs
(cd ../../data/ilsvrc12; make)
make[1]: Entering directory '/arch_lnx/aws/arch/install/mvdus/ncsdk/examples/data/ilsvrc12'
make[1]: Leaving directory '/arch_lnx/aws/arch/install/mvdus/ncsdk/examples/data/ilsvrc12'

making prototxt
Prototxt file already exists

making caffemodel
caffemodel file already exists

making compile
mvNCCompile -w bvlc_googlenet.caffemodel -s 12 deploy.prototxt
Traceback (most recent call last):
  File "/usr/local/bin/mvNCCompile", line 25, in <module>
    from Models.Blob import *
  File "/usr/local/bin/ncsdk/Models/Blob.py", line 19, in <module>
    from Controllers.MiscIO import *
  File "/usr/local/bin/ncsdk/Controllers/MiscIO.py", line 34, in <module>
    from mvnc import mvncapi
ModuleNotFoundError: No module named 'mvnc'
Makefile:80: recipe for target 'compile' failed
make: *** [compile] Error 1

I checked my path to make sure movidius is included and it is

GoogLeNet$ echo $PYTHONPATH
/usr/local/lib/python3.5/site-packages/::/opt/movidius/caffe/python:/opt/movidius/caffe/python:/opt/movidius/mvnc/python

Then I tried this on the Raspberry Pi 3B-Stretch

This time it works when virtual environment is not used but I got the mvnc not found error with the virtual environment.

Without virtual environment the graph builds:

(cv3.3_py3.5) pi@pi3:~/aws/arch/install_pi/ncsdk/examples/caffe/GoogLeNet$ deactivate
pi@pi3:~/aws/arch/install_pi/ncsdk/examples/caffe/GoogLeNet$ make compile

making prereqs
(cd ../../data/ilsvrc12; make)
make[1]: Entering directory '/home/pi/aws/arch/install_pi/ncsdk/examples/data/ilsvrc12'
make[1]: Leaving directory '/home/pi/aws/arch/install_pi/ncsdk/examples/data/ilsvrc12'

making prototxt
Prototxt file already exists

making caffemodel
caffemodel file already exists

making compile
mvNCCompile -w bvlc_googlenet.caffemodel -s 12 deploy.prototxt
mvNCCompile v02.00, Copyright @ Movidius Ltd 2016

Layer  inception_3b/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_3b/pool_proj  forced to im2col_v2, because its output is used in concat
Layer  inception_4a/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_4a/pool_proj  forced to im2col_v2, because its output is used in concat
Layer  inception_4b/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_4b/pool_proj  forced to im2col_v2, because its output is used in concat
Layer  inception_4c/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_4c/pool_proj  forced to im2col_v2, because its output is used in concat
Layer  inception_4d/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_4d/pool_proj  forced to im2col_v2, because its output is used in concat
Layer  inception_4e/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_4e/pool_proj  forced to im2col_v2, because its output is used in concat
Layer  inception_5a/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_5a/pool_proj  forced to im2col_v2, because its output is used in concat
Layer  inception_5b/1x1  forced to im2col_v2, because its output is used in concat
Layer  inception_5b/pool_proj  forced to im2col_v2, because its output is used in concat

The python path for the working example is:

pi@pi3:~/aws/arch/install_pi/ncsdk/examples/caffe/GoogLeNet$ echo $PYTHONPATH
:/opt/movidius/caffe/python:/opt/movidius/mvnc/python:/opt/movidius/caffe/python:/opt/movidius/mvnc/python:/opt/movidius/caffe/python:/opt/movidius/mvnc/python

With the virtual environment the example can't find the mvnc:

(cv3.3_py3.5) pi@pi3:~/aws/arch/install_pi/ncsdk/examples/caffe/GoogLeNet$ make compile

making prereqs
(cd ../../data/ilsvrc12; make)
make[1]: Entering directory '/home/pi/aws/arch/install_pi/ncsdk/examples/data/ilsvrc12'
make[1]: Leaving directory '/home/pi/aws/arch/install_pi/ncsdk/examples/data/ilsvrc12'

making prototxt
Prototxt file already exists

making caffemodel
caffemodel file already exists

making compile
mvNCCompile -w bvlc_googlenet.caffemodel -s 12 deploy.prototxt
Traceback (most recent call last):
  File "/usr/local/bin/mvNCCompile", line 25, in <module>
    from Models.Blob import *
  File "/usr/local/bin/ncsdk/Models/Blob.py", line 19, in <module>
    from Controllers.MiscIO import *
  File "/usr/local/bin/ncsdk/Controllers/MiscIO.py", line 34, in <module>
    from mvnc import mvncapi
ImportError: No module named 'mvnc'
Makefile:80: recipe for target 'compile' failed
make: *** [compile] Error 1

Path is also set correctly here:

(cv3.3_py3.5) pi@pi3:~/aws/arch/install_pi/ncsdk/examples/caffe/GoogLeNet$ echo $PYTHONPATH
:/opt/movidius/caffe/python:/opt/movidius/mvnc/python:/opt/movidius/caffe/python:/opt/movidius/mvnc/python:/opt/movidius/caffe/python:/opt/movidius/mvnc/python:/opt/movidius/caffe/python:/opt/movidius/mvnc/python

My questions are:
- Is there an extra step to setup the .so for mvnc when I set up a virtual environment?
- For the ubuntu example, why mvnc cannot be found even when the path is set?

Any help would be much appreciated.

Thank you

Comments

  • 6 Comments sorted by Votes Date Added
  • I believe I solve the can't find mvnc for virtual environment issue, but there is still something wrong

    for the virtual environment additional link to mvnc should be added as follows:

    cd /home/pi/.virtualenvs/cv3.3_py3.5/lib/python3.5/site-packages
    ln -s /usr/local/lib/python3.5/dist-packages/mvnc .
    ln -s /usr/local/lib/python3.5/dist-packages/graphviz .
    pip3 install protobuf pyyaml
    

    now the "can't find mvnc module" error goes away.

    but I'm still getting the following error,

    (cv3.3_py3.5) pi@pi3:~/aws/arch/install/mvdus/ncsdk/examples/caffe/GoogLeNet$ make compile
    
    making prereqs
    (cd ../../data/ilsvrc12; make)
    make[1]: Entering directory '/media/pi/PEGASUS/pi3/aws/arch/install/mvdus/ncsdk/examples/data/ilsvrc12'
    make[1]: Leaving directory '/media/pi/PEGASUS/pi3/aws/arch/install/mvdus/ncsdk/examples/data/ilsvrc12'
    
    making prototxt
    Prototxt file already exists
    
    making caffemodel
    caffemodel file already exists
    
    making compile
    mvNCCompile -w bvlc_googlenet.caffemodel -s 12 deploy.prototxt
    mvNCCompile v02.00, Copyright @ Movidius Ltd 2016
    
    Caffe Import Error
    

    what's a good way of debugging "mvNCCompile"?

  • @AshwinVijayakumar The OP said about virtualenv not virtual machine. And I'm having same issue as the OP, difficulty of using NCS from virtualenv / pyenv

  • edited November 2017 Vote Up0Vote Down

    Further investigation shows problem with the previous make compile, similar to https://ncsforum.movidius.com/discussion/323/caffe-import-error-with-fresh-installed-sdk-help-ncsdk-1-09-00-04-x86-64-ubuntu-16-04#latest but caused by protobuf

    [ 76%] Linking CXX executable upgrade_solver_proto_text
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::DebugString[abi:cxx11]() const'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::MessageLite::ParseFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::NameOfEnum[abi:cxx11](google::protobuf::EnumDescriptor const*, int)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)'
    collect2: error: ld returned 1 exit status
    tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:131: recipe for target 'tools/upgrade_solver_proto_text' failed
    make[3]: *** [tools/upgrade_solver_proto_text] Error 1
    
    ...
    
    [ 76%] Linking CXX executable upgrade_solver_proto_text
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::DebugString[abi:cxx11]() const'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::MessageLite::ParseFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::NameOfEnum[abi:cxx11](google::protobuf::EnumDescriptor const*, int)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, google::protobuf::io::CodedOutputStream*)'
    ../lib/libcaffe.so.1.0.0: undefined reference to `google::protobuf::internal::ArenaStringPtr::AssignWithDefault(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const*, google::protobuf::internal::ArenaStringPtr)'
    collect2: error: ld returned 1 exit status
    tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:131: recipe for target 'tools/upgrade_solver_proto_text' failed
    

    because the make process moves past the error, the compile error was missed. A suggestion is to provide the last message in the make output to let the user know if there are errors or not.

    I tried rebuilding protobuf https://github.com/google/protobuf/blob/master/src/README.md
    but this didn't work

    my gcc version is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609

    found some similar problem posts online but no good solutions.

    Anyone has a solution to this?

  • @AshwinVijayakumar
    I got the errors when running the commands just like "python image-classifier.py" in /ncappzoo/apps/image-classifier

    Traceback (most recent call last):
    File "image-classifier.py", line 10, in
    import mvnc.mvncapi as mvnc
    ImportError: No module named mvnc.mvncapi

    And I've checked the PYTHONPATH : /opt/movidius/caffe/python:/opt/movidius/mvnc/python::/opt/movidius/caffe/python

  • edited June 13 Vote Up0Vote Down

    I wish I could offer help, but for now I'm just going to chime in with confirmation that I saw the same issue. For what it's worth to the folks at Intel who are following this, I ran into these same errors when attempting to use the Virtualenv setup. The configuration created by the NCSDK installer is very broken. I noticed it did not edit the PYTHONPATH in .bashrc. It cannot find Caffe while in the Virtualenv. The more I fought to try to provide the Virtualenv with a path to the broken imports, the more broken imports it would uncover.

    When I attempted the Virtualenv install I was using Ubilinux on a new Up Board. I got so fed up with the process that I replaced Ubilinux with Ubuntu 16.04 (completely fresh install) and re-installed the NCSDK directly (not using Virtualenv!). The PYTHONPATH was edited properly in .bashrc and the broken import chains went away. I can't say what effect Ubilinux/Ubuntu had on the errors I was seeing but I personally suspect a broken Virtualenv configuration was the culprit.

    Folks at Intel, this was the first of two major breaks in your installation that I have found so far (see https://ncsforum.movidius.com/discussion/876/mvnccompile-fails-illegal-instruction).

    • Matt
  • @jfshi, regarding virtual machine setup - please refer our virtual machine installation guide @ https://movidius.github.io/ncsdk/VirtualMachineConfig.html

    The Caffe Import Error is usually because of PYTHONPATH issues, please refer the following posts for pointers on this issue.

    mvNCCompile source code is available @ /opt/movidius/NCSDK/ncsdk-x86_64/tk and /opt/movidius/NCSDK/ncsdk-armv71/tk, you can use that to further debug mvNCCompile if you choose to do so.

Sign In or Register to comment.