Coral Dev Board Windows 10 setup - google-coral

I followed the windows host instructions described in the https://coral.ai/docs/dev-board/get-started/
When I run command mdt devices, I get following exception always:
$ mdt devices
Traceback (most recent call last):
File "c:\users\ram\anaconda3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\ram\anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Ram\AppData\Roaming\Python\Python38\Scripts\mdt.exe\__main__.py", line 7, in
<module>
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\mdt\main.py", line 162, in
main
exit(command.run(sys.argv[1:]))
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\mdt\devices.py", line 43, i
n run
self.discoverer.discover()
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\mdt\discoverer.py", line 40
, in discover
self.zeroconf = Zeroconf()
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2508, in __init__
self._listen_socket, self._respond_sockets = create_sockets(
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2343, in create_sockets
respond_socket = new_respond_socket(i, apple_p2p=apple_p2p)
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2302, in new_respond_socket
respond_socket = new_socket(
File "C:\Users\Ram\AppData\Roaming\Python\Python38\site-packages\zeroconf\__init__.py", line
2250, in new_socket
s.bind((bind_addr[0], port, *bind_addr[1:]))
OSError: [WinError 10049] The requested address is not valid in its context
Versions of my set up:
$ python --version
Python 3.8.5
$ mdt version
MDT version 1.5.2
Can you please help me to resolve this issue?

The same happened to me. Skipping some IP addresses solved the issue. Try this code:
import logging
import zeroconf
import ifaddr
for adapter in ifaddr.get_adapters():
print("IPs of network adapter ", adapter.nice_name)
for ip in adapter.ips:
print(" %s/%s", ip.ip, ip.network_prefix)
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("zeroconf").setLevel(level=logging.DEBUG)
z = zeroconf.Zeroconf()
From the log, find
INFO:zeroconf:Address not available when adding XXX.XXX.XX.XX to multicast group, it is expected to happen on some systems
Along with the Zeroconf log, there should be a list of ip addresses and names. Please find the name of the hardware that is causing the problem.
Now, open zeroconf/__init__.py and goto get_all_addresses() and replace the code with below
adapters = [x for x in ifaddr.get_adapters()
if not "Microsoft Wi-Fi Direct Virtual Adapter" in x.nice_name
and not "Bluetooth Device" in x.nice_name]
return list(set(addr.ip for iface in adapters for addr in iface.ips if addr.is_IPv4))
Please replace the "Microsoft Wi-Fi Direct Virtual Adapter" and "Bluetooth Device" with the appropriate name.
This is not a neat way, so I'd be open to better answers.

Related

Trouble with minimqtt and CircuitPython

I have been unable to connect to io.adafruit by mqtt, and I wonder if it is the minimqtt library. I am using the stock example code on github.
Example code: here
Board: Adafruit Esp32-S2 Feather
Firmware: CircuitPython 7.3.2
Secrets File:
secrets = {
'ssid' : '[deleted]',
'password' : '[deleted]',
'aio_username' : '[deleted]',
'aio_key' : '[deleted]',
'timezone' : "America/New_York", # http://worldtimeapi.org/timezones
'broker' : 'io.adafruit.com',
'port' : 1883
}
Output:
Connecting to [home network]
Connected to [home network]!
Attempting to connect to io.adafruit.com
Traceback (most recent call last):
File "code.py", line 97, in
File "adafruit_minimqtt/adafruit_minimqtt.py", line 441, in connect
File "adafruit_minimqtt/adafruit_minimqtt.py", line 254, in _get_connect_socket
TypeError: extra positional arguments given
I was having similar errors using the Unexpected Maker ESP32-S2 as well.
Possibly related github issues? #3836, #4394

Permission error accessing USB from homeassistant docker

I am running homeassistant in a docker container on a RPi 4 with Raspbian. I am using tributs scripts to elevate the need of running the docker image as root. This all works dandy. But now I am trying to add the dsmr integration but I am not succeeding. The integration requires to connect to the "Slimme meter" via USB. However, I get a permission error. my knowledge of both docker and linux privelages is too limited to know where to start debugging this. Does anyone have some pointers for me?
This is the error message homeassistant is throwing at me:
Logger: homeassistant.components.dsmr
Source: components/dsmr/config_flow.py:93
Integration: dsmr (documentation, issues)
First occurred: 21:18:17 (1 occurrences)
Last logged: 21:18:17
Error connecting to DSMR
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/serial/serialposix.py", line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: '/dev/ttyUSB0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/dsmr/config_flow.py", line 93, in validate_connect
transport, protocol = await asyncio.create_task(reader_factory())
File "/usr/local/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 445, in create_serial_connection
serial_instance = serial.serial_for_url(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/serial/__init__.py", line 90, in serial_for_url
instance.open()
File "/usr/local/lib/python3.9/site-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
After some researching I figured that I needed to add the user to an extra group named dialout because only members of that group are allowed to access the USB ports (as well as other devices).
First I figured out the group id of the dialout group in the host machine (the machine running the docker container) by running
cat /etc/group | grep dialout
it returned 20 in my case. Luckily, the script of tributs has the possibility to add the user to an extra group via the environment variable EXTRA_GID. So all the relevant lines in the docker-compose file for accessing USB are (when using the script of tribut) are:
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
environment:
- PUID=1000
- PGID=1000
- EXTRA_GID=20 # this is the ID of the group 'dialout'

Coral Dev Board - Can't get demo to run

I recently purchased a used dev board to start working on. I managed to flash it with Mendel 5 (Eagle) enabled SSH and followed the instructions on the get started without any issue until I tried the demo.
I can't get it to work at all!
If I run edgetpu_demo --stream
I get:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Press 'q' to quit.
Press 'n' to switch between models.
Traceback (most recent call last):
File "/usr/bin/edgetpu_detect_server", line 11, in <module>
load_entry_point('edgetpuvision==1.0', 'console_scripts', 'edgetpu_detect_server')()
File "/usr/lib/python3/dist-packages/edgetpuvision/detect_server.py", line 33, in main
run_server(add_render_gen_args, render_gen)
File "/usr/lib/python3/dist-packages/edgetpuvision/apps.py", line 43, in run_server
camera = make_camera(args.source, next(gen), args.loop)
File "/usr/lib/python3/dist-packages/edgetpuvision/detect.py", line 144, in render_gen
engines, titles = utils.make_engines(args.model, DetectionEngine)
File "/usr/lib/python3/dist-packages/edgetpuvision/utils.py", line 53, in make_engines
engine = engine_class(model_path)
File "/usr/lib/python3/dist-packages/edgetpu/detection/engine.py", line 80, in __init__
super().__init__(model_path)
File "/usr/lib/python3/dist-packages/edgetpu/basic/basic_engine.py", line 92, in __init__
self._engine = BasicEnginePythonWrapper.CreateFromFile(model_path)
RuntimeError: No Edge TPU device detected!
running as root gives me:
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Press 'q' to quit.
Press 'n' to switch between models.
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
(edgetpu_detect_server:7283): Gtk-WARNING **: 02:24:31.914: cannot open display:
Which seems closer but no idea how to fix either. I've searched as much as I can (added the user the plugdev, made sure everything was installed correctly)
Any ideas? Pretty sure if this doesn't work something is fairly broken.
Thanks for reaching out, this is definitely not a good sign..
RuntimeError: No Edge TPU device detected!
Sounds like the board some how lost access to the edgetpu, could you send us an email to coral-support#google.coon this issue?

Cannot start dask cluster over SSH

I'm trying to start a dask cluster over SSH, but I am encountering a strange errors like these:
Exception in thread Thread-6:
Traceback (most recent call last):
File "/home/localuser/miniconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/localuser/miniconda3/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/localuser/miniconda3/lib/python3.6/site-packages/distributed/deploy/ssh.py", line 57, in async_ssh
banner_timeout=20) # Helps prevent timeouts when many concurrent ssh connections are opened.
File "/home/localuser/miniconda3/lib/python3.6/site-packages/paramiko/client.py", line 329, in connect
to_try = list(self._families_and_addresses(hostname, port))
File "/home/localuser/miniconda3/lib/python3.6/site-packages/paramiko/client.py", line 200, in _families_and_addresses
hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
File "/home/localuser/miniconda3/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
I'm starting the cluster like this:
$ dask-ssh --ssh-private-key ~/.ssh/cluster_id_rsa \
--hostfile ~/dask-hosts.txt \
--remote-python "~/miniconda3/bin/python3.6"
My dask-hosts.txt looks like this:
localuser#127.0.0.1
remoteuser#10.10.4.200
...
remoteuser#10.10.4.207
I get the same error with/without the localhost line.
I have checked the ssh setup, I can login to all the nodes using a public key setup (the key is unencrypted, to avoid decryption prompts). What am I missing?
The error indicates that name resolution is the culprit. Most likely this is happening because of the inclusion of usernames in your dask-hosts.txt. According to its documentation, the host file should contain only hostnames/IP addresses:
–hostfile PATH Textfile with hostnames/IP addresses
You can use --ssh-username to set a username (although only a single one).

Python 3 runing script from one user works but from the other doesn't?

When i run this script from user jenkins (Linux Mint) i get this error, and when running it from my user it works. Jenkins user is created with jenkins service. I have installed virtualenv.
import unittest
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
DRIVER = None
def getOrCreateWebdriver():
global DRIVER
DRIVER = DRIVER or webdriver.Firefox()
return DRIVER
class LoginTest(unittest.TestCase):
def setUp(self):
self.browser = getOrCreateWebdriver()
def test_Loggin(self):pass
browser = self.browser
def tearDown(self):
self.browser.close()
if __name__ == '__main__':
unittest.main(verbosity=2)
From user jenkins when i run this script i get error :
test_Loggin (__main__.LoginTest) ... ERROR
/usr/lib/python3.4/unittest/case.py:602: ResourceWarning: unclosed file <_io.BufferedWriter name='/dev/null'>
outcome.errors.clear()
======================================================================
ERROR: test_Loggin (__main__.LoginTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Test.py", line 16, in setUp
self.browser = getOrCreateWebdriver()
File "Test.py", line 10, in getOrCreateWebdriver
DRIVER = DRIVER or webdriver.Firefox()
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/webdriver.py", line 64, in __init__
self.binary, timeout),
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/extension_connection.py", line 51, in __init__
self.binary.launch_browser(self.profile)
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 70, in launch_browser
self._wait_until_connectable()
File "/usr/local/lib/python3.4/dist-packages/selenium/webdriver/firefox/firefox_binary.py", line 100, in _wait_until_connectable
raise WebDriverException("The browser appears to have exited "
selenium.common.exceptions.WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
When you're logged in as yourself, you need to do echo $DISPLAY and note the display info it prints. Subsequently when you login as jenkins service you need to do xhost +, DISPLAY=[display-info]; export DISPLAY. (display-info is what you got from echo $DISPLAY, ignore the square brackets, they shouldn't be specified in the command)
Hopefully this should work. I don't have similar env to test, just mentioning what i recollect having done it quite sometime back.

Resources