loretoparisi
loretoparisi

Reputation: 16301

Run NCSDK Movidius Neural Stick on macOS

I'm trying to run the Movidius NCSDK on macOS. Using the NCSDK on macOS requires VirtualBox plus docker since this USB stick must run on Ubuntu16.04 and it supports Tensorflow and Caffe. I have successfully compiled the NCSDK on docker using this Dockerfile. I have then created a docker-machine and attached to virtualbox as usual:

$ docker-machine create --driver virtualbox linux
$ eval $(docker-machine env linux)
$ docker-machine ls
NAME    ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS
linux   *        virtualbox   Running   tcp://192.168.99.100:2376           v17.12.1-ce 
$ docker-machine env linux
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.100:2376"
export DOCKER_CERT_PATH="/Users/loretoparisi/.docker/machine/machines/linux"
export DOCKER_MACHINE_NAME="linux"
# Run this command to configure your shell: 
# eval $(docker-machine env linux)

and I have plugged the device into VirtualBox, so when running the docker image like

docker run --rm -it movidius bash

I can see the device connected:

movidius@macos:~/ncsdk/examples/apps/hello_ncs_cpp$ lsusb
Bus 001 Device 005: ID 03e7:2150  
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

where 03e7 is the Intel device as expected in the linux device ids list here:

03e7  Intel
    2150  Myriad VPU [Movidius Neural Compute Stick]

So I was supposed to make and run:

cd examples/apps/hello_ncs_cpp/ \
make hello_ncs_cpp \ 
make run

But I get

cd cpp; ./hello_ncs_cpp; cd ..
Error - Could not open NCS device.
    mvncStatus value: -6

I get the same error when trying to python example

movidius@macos:~/ncsdk/examples/apps/hello_ncs_py$ python hello_ncs.py 
Error - Could not open NCS device.

Looking at the python code I can see the device has been enumerated correctly:

     # get a list of names for all the devices plugged into the system
    ncs_names = fx.EnumerateDevices()
    if (len(ncs_names) < 1):
        print("Error - no NCS devices detected, verify an NCS device is connected.")
        quit()


    # get the first NCS device by its name.  For this program we will always open the first NCS device.
    dev = fx.Device(ncs_names[0])

    print(ncs_names[0])

since I can see 1 as the device name. Printing the error stacktrace for the dev.OpenDevice() api I have got:

mvncStatus.ERROR
Traceback (most recent call last):
  File "hello_ncs.py", line 43, in <module>
    dev.OpenDevice()
  File "/usr/local/lib/python2.7/dist-packages/mvnc/mvncapi.py", line 147, in OpenDevice
    raise Exception(Status(status))
Exception: mvncStatus.ERROR
Error - Could not open NCS device.

I have also tried to attach the device using the docker option --device with no success trying like:

docker run --rm -it --net=host --privileged --device=/dev/usb/hiddev4

as described here.

[UPDATE] I'm aware of the same driver issue on the most recent version of Microsoft Windows and Microsoft Surface laptop.

Upvotes: 2

Views: 1900

Answers (2)

jeff
jeff

Reputation: 46

Within the Docker container, you must run the make run as root user, not a normal user. The reason is because Docker doesn't support udev/udevadm service and so only root can access usb devices.

Upvotes: 3

user9427613
user9427613

Reputation:

See if you can resolve the issue by following this thread: https://ncsforum.movidius.com/discussion/140/mac-os-x

Please refer point 8 of Ramana.rachakonda : "Stick only worked when connected to a USB2 port on a USB hub that i had and not when connected to the USB3 port. If you only have USB3 ports try connecting the stick with a USB2 extension cable".

Upvotes: -1

Related Questions