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!

Python can't find the mvnc Module

I've been trying to setup the movidius library created by intel, but I keep getting stuck when I try to import the mvnc package.

To set up mvnc I followed the directions here: https://www.pyimagesearch.com/2018/02/19/real-time-object-detection-on-the-raspberry-pi-with-the-movidius-ncs/

and when it comes time to test if the install works, I run

make examples

which gives this error whenever I run it.

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 35, in <module>
    from mvnc import mvncapi

So I'm wondering how it would be possible to get python to recognize the mvnc module so I can import it into any of my code. Thank you for your help!

I'm running Ubuntu 18.04.1 LTS in a virtual machine on a windows 10 computer

Here's the full command line output:

./install-opencv.sh
Installing opencv python for non-Raspbian
[sudo] password for odyssey: 
Requirement already satisfied: opencv-python in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: numpy>=1.11.3 in /usr/lib/python3/dist-packages (from opencv-python)
Requirement already satisfied: opencv-contrib-python in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: numpy>=1.11.3 in /usr/lib/python3/dist-packages (from opencv-contrib-python)

make examples starting.
(cd examples; make)
make[1]: Entering directory '/home/odyssey/workspace/ncsdk/examples'
make -C apps/. 
make[2]: Entering directory '/home/odyssey/workspace/ncsdk/examples/apps'
make -C hello_ncs_py/. 
make[3]: Entering directory '/home/odyssey/workspace/ncsdk/examples/apps/hello_ncs_py'
nothing to make, use 'make run' to run.
make[3]: Leaving directory '/home/odyssey/workspace/ncsdk/examples/apps/hello_ncs_py'
make -C multistick_cpp/. 
make[3]: Entering directory '/home/odyssey/workspace/ncsdk/examples/apps/multistick_cpp'

making googlenet
(cd ../../caffe/GoogLeNet; make compile; cd ../../apps/multistick_cpp; cp ../../caffe/GoogLeNet/graph ./googlenet.graph;)
make[4]: Entering directory '/home/odyssey/workspace/ncsdk/examples/caffe/GoogLeNet'

making prereqs
(cd ../../data/ilsvrc12; make)
make[5]: Entering directory '/home/odyssey/workspace/ncsdk/examples/data/ilsvrc12'
make[5]: Leaving directory '/home/odyssey/workspace/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 35, in <module>
    from mvnc import mvncapi
ModuleNotFoundError: No module named 'mvnc'
Makefile:80: recipe for target 'compile' failed
make[4]: *** [compile] Error 1
make[4]: Leaving directory '/home/odyssey/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/odyssey/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/odyssey/workspace/ncsdk/examples/apps'
Makefile:12: recipe for target 'apps/.' failed
make[1]: *** [apps/.] Error 2
make[1]: Leaving directory '/home/odyssey/workspace/ncsdk/examples'
Makefile:57: recipe for target 'examples' failed
make: *** [examples] Error 2

Comments

  • 16 Comments sorted by Votes Date Added
  • @Cynopolis Were you able to install the NCSDK successfully? Can you post the install log here? After a successful installation, make sure you run make examples in a new terminal window so that the pythonpath is set. You can check the pythonpath after installation by opening a new terminal window and typing in the following command: echo $PYTHONPATH

  • Sure, I added a link to the install log because it's too long to just paste in. The install did go successfully.
    and this is the output I get when I run echo $PYTHONPATH
    :/opt/movidius/caffe/python

    Here's the link to the install log:
    https://drive.google.com/open?id=1q2FmC9aB2h_wvS8FiGnBV7kFE88RNdo9

  • @Cynopolis Okay it looks like your install was successful. Can you do me a favor and go into one of the example folders like AgeNet, GenderNet or SqueezeNet and type in the command make run and see if it is able to run correctly? Thanks.

  • making prereqs
    (cd ../../data/ilsvrc12; make)
    make[1]: Entering directory '/home/odyssey/workspace/ncsdk/examples/data/ilsvrc12'
    make[1]: Leaving directory '/home/odyssey/workspace/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 35, in <module>
        from mvnc import mvncapi
    ModuleNotFoundError: No module named 'mvnc'
    Makefile:80: recipe for target 'compile' failed
    make: *** [compile] Error 1
    

    That's the error I get when I try to run GoogLeNet, I also tried both AlexNet and SqueezeNet and I get the same problem.

  • Does anyone know how I could solve this problem? I'm thinking python doesn't know where the mvncapi.py file is, so is there a way to point it to that file?

  • edited September 16 Vote Up0Vote Down

    @Cynopolis
    How is your environment variable registered?

    $ sudo find / -name mvncapi.py
    /usr/local/lib/python3.5/dist-packages/mvnc/mvncapi.py
    /usr/local/lib/python2.7/dist-packages/mvnc/mvncapi.py
    /home/xxxx/ncsdk/api/python/mvnc/mvncapi.py
    /opt/movidius/NCSDK/ncsdk-armv7l/api/python/mvnc/mvncapi.py
    /opt/movidius/NCSDK/ncsdk-x86_64/api/python/mvnc/mvncapi.py
    

    Below is mine.

    $ echo $PYTHONPATH
    :/opt/movidius/caffe/python:/usr/local/lib
    

    If "/usr/local/lib" is not displayed, the environment is wrong.

  • edited September 16 Vote Up0Vote Down

    Here's my out put for

    sudo find / -name mvncapi.py
    [sudo] password for odyssey: 
    /home/odyssey/.local/share/Trash/files/workspace/ncsdk/api/python/mvnc/mvncapi.py
    /home/odyssey/workspace/ncsdk/api/python/mvnc/mvncapi.py
    /home/odyssey/workspace/mvncsdk/ncsdk-1.12.00.01/api/python/mvnc/mvncapi.py
    find: ‘/run/user/1000/gvfs’: Permission denied
    /opt/movidius/NCSDK/ncsdk-armv7l/api/python/mvnc/mvncapi.py
    /opt/movidius/NCSDK/ncsdk-x86_64/api/python/mvnc/mvncapi.py
    /usr/local/lib/python3.6/dist-packages/mvnc/mvncapi.py
    /usr/local/lib/python2.7/dist-packages/mvnc/mvncapi.py
    

    and here's my output for

    echo $PYTHONPATH
    :/opt/movidius/caffe/python
    

    as you can see "usr/local/lib" isn't there, is there a way to fix that?

  • edited September 16 Vote Up0Vote Down

    @Cynopolis

    $ export PYTHONPATH=$PYTHONPATH:/usr/local/lib:/usr/local/lib/python3.6/dist-packages/mvnc
    
  • I ran that command and now my python path looks like:

    echo $PYTHONPATH
    :/opt/movidius/caffe/python:/usr/local/lib:/usr/local/lib/python3.6/dist-packages/mvnc
    

    but I ran make examples, and still got the same error:

    ./install-opencv.sh
    Installing opencv python for non-Raspbian
    [sudo] password for odyssey: 
    Requirement already satisfied: opencv-python in /usr/local/lib/python3.6/dist-packages
    Requirement already satisfied: numpy>=1.11.3 in /usr/lib/python3/dist-packages (from opencv-python)
    Requirement already satisfied: opencv-contrib-python in /usr/local/lib/python3.6/dist-packages
    Requirement already satisfied: numpy>=1.11.3 in /usr/lib/python3/dist-packages (from opencv-contrib-python)
    
    make examples starting.
    (cd examples; make)
    make[1]: Entering directory '/home/odyssey/workspace/ncsdk/examples'
    make -C apps/. 
    make[2]: Entering directory '/home/odyssey/workspace/ncsdk/examples/apps'
    make -C hello_ncs_py/. 
    make[3]: Entering directory '/home/odyssey/workspace/ncsdk/examples/apps/hello_ncs_py'
    nothing to make, use 'make run' to run.
    make[3]: Leaving directory '/home/odyssey/workspace/ncsdk/examples/apps/hello_ncs_py'
    make -C multistick_cpp/. 
    make[3]: Entering directory '/home/odyssey/workspace/ncsdk/examples/apps/multistick_cpp'
    
    making googlenet
    (cd ../../caffe/GoogLeNet; make compile; cd ../../apps/multistick_cpp; cp ../../caffe/GoogLeNet/graph ./googlenet.graph;)
    make[4]: Entering directory '/home/odyssey/workspace/ncsdk/examples/caffe/GoogLeNet'
    
    making prereqs
    (cd ../../data/ilsvrc12; make)
    make[5]: Entering directory '/home/odyssey/workspace/ncsdk/examples/data/ilsvrc12'
    make[5]: Leaving directory '/home/odyssey/workspace/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 35, in <module>
        from mvnc import mvncapi
    ImportError: cannot import name 'mvncapi'
    Makefile:80: recipe for target 'compile' failed
    make[4]: *** [compile] Error 1
    make[4]: Leaving directory '/home/odyssey/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/odyssey/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/odyssey/workspace/ncsdk/examples/apps'
    Makefile:12: recipe for target 'apps/.' failed
    make[1]: *** [apps/.] Error 2
    make[1]: Leaving directory '/home/odyssey/workspace/ncsdk/examples'
    Makefile:57: recipe for target 'examples' failed
    make: *** [examples] Error 2
    
  • I checked to see if both .bashrc and .profile existed in my home folder, and they do. By the looks of it, the .profile script is correctly locating the .bachrc file and loading it. Here's that code:

    # if running bash
    if [ -n "$BASH_VERSION" ]; then
        # include .bashrc if it exists
        if [ -f "$HOME/.bashrc" ]; then
            . "$HOME/.bashrc"
        fi
    fi
    
  • @Cynopolis It could be related to line endings depending on how you got the NCSDK. I recommend removing and re-downloading the NCSDK. Try the following steps:

    1. Uninstall your current NCSDK by using the uninstall.sh script in the ncsdk folder.
    2. Delete your current NCSDK folder.
    3. Get a new copy of the NCSDK files using the command: wget https://ncs-forum-uploads.s3.amazonaws.com/ncsdk/ncsdk-01_12_00_01-full/ncsdk-1.12.00.01.tar.gz
    4. Extract the files using the command tar xvf ncsdk-1.12.00.01.tar.gz
    5. Install the NCSDK by typing in cd ncsdk-1.12.00.01 and then make install
    6. Afterwards, try typing in the command: make examples

    Let me know if this works for you.

  • I have the same issue but have been waiting for a reply.
    Isn't this going back to version 1 of the SDK? Not version 2?

  • I am also facing the exact problem. Make install successful but make examples failed. I tried several ways to make it run. None of the ways is working!

  • @mthakkar Hi, have you tried going through each of the steps I listed above to see if they work for you? Please try each step even if it seems redundant and I'd appreciate it if you could let me know if it works/doesn't work. Thanks.

    @chicagobob123 Yeah, this was for NCSDK v1.12 as that is the version being installed by Cynopolis. If NCSDK v2.05 is desired, you can just replace the wget command with: wget https://ncs-forum-uploads.s3.amazonaws.com/ncsdk/ncsdk-02_05_00_02-full/ncsdk-2.05.00.02.tar.gz

  • I will try and reinstall the thing from scratch this asap. Let you know.
    Something is going on. I traced the path down and there was no mnvc anything to compile anything.
    Not sure whats going on. The installations seem more unstable now than ever.

Sign In or Register to comment.