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.

Linux virtual environment for NCS

idata
Employee
1,488 Views

I wrote up a vagrantfile and dockerfile for installing Movidius NCS. The vagrant environment spins up but I have not tested the hardware yet. The docker environment is a WIP and does not yet install the developer's kit.

 

Hope this helps someone.

 

https://github.com/hughdbrown/movidius

0 Kudos
13 Replies
idata
Employee
1,132 Views

I've updated the vagrant environment to include instructions for using USB drives with virtualbox and vagrant. Now when I run this vagrantfile, I get this

 

ubuntu@ubuntu-xenial:~/workspace/ncsdk/examples/apps/hello_ncs_py$ lsusb Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 03e7:2150 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub ubuntu@ubuntu-xenial:~/workspace/ncsdk/examples/apps/hello_ncs_py$ make run making run python3 hello_ncs.py; Hello NCS! Device opened normally. Goodbye NCS! Device closed normally. NCS device working.
0 Kudos
idata
Employee
1,132 Views

@hughdbrown Thank you for sharing this with our community. This will definitely be helpful to others on the forum who are developers and machine learning enthusiasts like yourself. There have been some users who have had USB related problems using the Intel NCS within a docker environment and we have found that including the --net=host flag can help make the device manager events visible to libusb in a docker environment. For example: sudo docker run --rm --net=host -it -v /etc/apt/apt.conf:/etc/apt/apt.conf:ro --privileged -v /dev:/dev:shared -v /media/data2/NCS/:/media/data2/NCS/ myimage:2 bash Appreciate the contribution and welcome to the Intel NCS forums!

0 Kudos
idata
Employee
1,132 Views

@Tome_at_Intel The problems I had with docker were before the point of running an image to create a container. My problem was at the point that I created the image. I could not run the NCS API installation in a docker image build because of the use of sudo if memory serves.

0 Kudos
idata
Employee
1,132 Views

Hello @Tome_at_Intel and @hughdbrown,

 

I've been trying to get the NCS to work in a docker container running running in a virtualbox VM on a Mac machine. I'm reaching out to ask for any advice you might have for this. It seems that I'm close to getting this to work, but not quite there yet. I'd be happy to share all my information when i have everything working.

 

I've set up and built the ncsdk and examples (NCSDK-1.10.00.02) in my container. One issue I always see is that the install-ncsdk.sh that runs when doing a make install always fails & aborts at line no. 609. So I end up running these 2 commands manually.

 

$SUDO_PREFIX udevadm control --reload-rules

 

$SUDO_PREFIX udevadm trigger

 

I have configured the USB port and filters in VirtualBox using information from here. Inside my container I can see the NCS when I do lsusb or lsusb -v. Here's the output:

 

lsusb: Bus 001 Device 005: ID 03e7:2150

 

I'm pasting the relevant output from the lsusb -v command at the end of this message.

 

However, when I try to run an example its never able to open the NCS device. E.g., this is the output from the hello_ncs_py:

 

making run

 

python3 hello_ncs.py;

 

Error - Could not open NCS device.

 

Based on information I found on the internet and your forum discussion thread, I've tried running the container using a few different parameters, e.g:

 

docker run -it --net=host --device=/dev/bus/usb:/dev/bus/usb:rwm dockrohit/ncsdk-b2d:v1.1 /bin/bash

 

docker run -it --net=host --privileged -v /dev/bus/usb:/dev/bus/usb dockrohit/ncsdk-b2d:v1.1 /bin/bash

 

(ran both of these without the --net=host option as well)

 

But I can't get this to work. Sample program is never able to open the NCS device.

 

Can you give me any other pointers that might help me to get this to work?

 

Interestingly, when I look at the output from dmesg after running sample code, I get the following output that indicates that the usb device gets disconnected and reconnected.

 

[ 0.000000] usb 2-1: USB disconnect, device number 3

 

[ 0.000000] usb 1-1: new high-speed USB device number 4 using xhci_hcd

 

I would very much appreciate any help on this.

 

Look forward to hearing from you.

 

Thanks

 

Rohit
0 Kudos
idata
Employee
1,132 Views

@hughdbrown I have a Dockerfile that works to do the install and make the examples. All that's missing is connecting to the device:

 

FROM ubuntu RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y \ build-essential \ git \ lsb-release \ sudo \ udev \ usbutil \ wget \ && apt-get clean all RUN useradd -c "Movidius User" -m movidius COPY 10-installer /etc/sudoers.d/ RUN mkdir -p /etc/udev/rules.d/ USER movidius WORKDIR /home/movidius RUN git clone https://github.com/movidius/ncsdk.git WORKDIR /home/movidius/ncsdk RUN make install RUN make examples

 

The file "10-installer" is one line - it lets the "movidius" user do sudo without a password:

 

movidius ALL=(ALL) NOPASSWD: ALL
0 Kudos
idata
Employee
1,132 Views

@znmeb, i tried building a docker image using your Dockerfile and get the following error towards the end of make install:

 

Updating udev rules…

 

Installation failed. Error on line 609

 

This is the same error I've been getting when i try to build a docker image using a slightly different Dockerfile. Please see my comment about this above on this thread from November 8. Even though I successfully run the failed commands manually, eventually when running any example (in make examples), the code is unable to open the NCS. I suspect this issue is related to the issue I get with make install.

 

Do you know how to resolve this error?

 

Some more log messages from make install around the failure:

 

Successfully installed mvnc-1.10.0.2

 

You are using pip version 8.1.1, however version 9.0.1 is available.

 

You should consider upgrading via the 'pip install --upgrade pip' command.

 

NCS Libraries have been installed in /usr/local/lib

 

NCS Toolkit binaries have been installed in /usr/local/bin

 

NCS Include files have been installed in /usr/local/include

 

NCS Python API has been installed in /opt/movidius, and PYTHONPATH environment variable updated

 

Updating udev rules…

 

Installation failed. Error on line 609

 

---> 0d7faa07ddd1

 

Removing intermediate container 65dc4b880dc3

 

Removing intermediate container 1926a5405b39

 

Removing intermediate container c803f25edecc

 

Removing intermediate container 674df40f3810

 

Removing intermediate container 5ad1cae7b431

 

Removing intermediate container e748573dd46c

 

Removing intermediate container 2b27a5af7ac4

 

Removing intermediate container 60c21fdbc154

 

Successfully built 0d7faa07ddd1

 

Thanks,

 

Rohit
0 Kudos
idata
Employee
1,132 Views

@rohit

 

     

  1. I don't know how to resolve the line 609 error - I'm going to attempt a troubleshooting pass over the weekend. I suspect there are some clues here https://guidodiepen.nl/2016/05/notification-of-new-usb-devices-in-docker-container/
  2.  

  3. You can ignore the pip errors.
  4.  

 

P.S.: For the Intel folks - make install runs a script called install.sh. This script in turn runs another script called /opt/movidius/install-ncsdk.sh, which actually does the work. _However_, when the second script finishes, whether or not it was successful, the first script deletes it! This makes troubleshooting next to impossible! I recommend removing that line:

 

sudo rm ./install-ncsdk.sh

 

I can submit a pull request if you want; I looked at the repo and there wasn't an issues tab so I'm holding off.

0 Kudos
idata
Employee
1,132 Views

@znmeb Understand the issues removal of the install-ncsdk.sh is causing. Let us look into removing this line.

0 Kudos
idata
Employee
1,132 Views

@Tome_at_Intel I tried the docker run command you gave but got an error.

 

docker run --rm --net=host -it -v /etc/apt/apt.conf:/etc/apt/apt.conf:ro --privileged -v /dev:/dev:shared -v /media/data2/NCS/:/media/data2/NCS/ myimage:2 bash

 

_docker: Error response from daemon: linux mounts: path /dev is mounted on /dev but it is not a shared mount._

0 Kudos
idata
Employee
1,132 Views

@znmeb small error in your dockerfile script. Should be usbutils instead of usbutil.

0 Kudos
idata
Employee
1,132 Views

@ramana.rachakonda what is the correct docker command to run? I had issues running the provided command above.

0 Kudos
idata
Employee
1,132 Views

Just got this to work with Docker on a CentOS 7 box.

 

I used the Dockerfile from the comment from @znmeb, although with usbutils instead of usbutil as @davenso pointed out.

 

To run up the Docker container, as root, I run:

 

docker run --rm --net=host -it --privileged -v /dev:/dev movidius /bin/bash

 

Then cd to examples and run:

 

sudo make run

0 Kudos
idata
Employee
1,132 Views

I am new to using Docker, and attempting to use a working NCS inference (using Ubuntu 16.04) on a Centos 7 platform. I was hoping someone could summarize the above solution in layman's terms

 

Especially: What part on Ubuntu OS and what part on CentOS?

 

Thanks

 

@ajtucker @Tome_at_Intel @znmeb
0 Kudos
Reply