Deploy IoT Edge module to a Windows device - docker

I am creating IoT Edge using the blog https://learn.microsoft.com/en-us/azure/iot-edge/quickstart.
I have installed Python 2.7, azure-iot-edge-runtime-ctl on a Windows 1709 Virtual machine.
I am running Docker version 17.09 CE and Windows Containers. When I am trying to setup IoT-edge runtime module in Windows 10 VM.
iotedgectl setup --connection-string "{device connection string}" --auto-cert-gen-force-no-passwords
when I am running above command facing the issue, Any suggestions appreciated.
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\iotedgectl.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\edgectl\__init__.py", line 25, in coremain
return cli.execute_user_command()
File "c:\python27\lib\site-packages\edgectl\edgecli.py", line 54, in execute_user_command
(is_valid, execute_deployment_cmd) = self._process_cli_args()
File "c:\python27\lib\site-packages\edgectl\edgecli.py", line 358, in _process_cli_args
return args.func(args)
File "c:\python27\lib\site-packages\edgectl\edgecli.py", line 379, in _parse_edge_command
if EdgeDefault.is_deployment_supported(self._deployment):
File "c:\python27\lib\site-packages\edgectl\default.py", line 99, in is_deployment_supported
client = EdgeDockerClient()
File "c:\python27\lib\site-packages\edgectl\dockerclient.py", line 13, in __init__
self._client = docker.DockerClient.from_env()
File "c:\python27\lib\site-packages\docker\client.py", line 81, in from_env
**kwargs_from_env(**kwargs))
File "c:\python27\lib\site-packages\docker\client.py", line 38, in __init__
self.api = APIClient(*args, **kwargs)
File "c:\python27\lib\site-packages\docker\api\client.py", line 131, in __init__
'Install pypiwin32 package to enable npipe:// support'
docker.errors.DockerException: Install pypiwin32 package to enable npipe:// support
Any suggestions, please.

Problem Solution:
The “npipe:// broken” problem reported here applicable to Windows machines and is a problem whether Linux or Windows containers are used in Docker.
azure-iot-edge-runtime-ctl 1.0.0rc19 was released recently which addresses this issue by ensuring the correct pypiwin32 package is installed.
To get the latest bits execute:
$> pip install -U azure-iot-edge-runtime-ctl
Check installed version:
$> iotedgectl --version
iotedgectl 1.0.0rc19
Summary of issue:
iotedgectl uses library docker-py to communicate with Docker for kick starting and controlling the Edge runtime.
docker-py uses pypiwin32 for communicating with docker over named pipes (npipe). With the release of v222 of pypiwin32 docker-py is broken on Windows hosts.
As a quick workaround until the official fixes can be incorporated, iotedgectl was released which ensures that correctly working dependencies get pulled in.

Is the version of Python you have installed 2.7.14?It seems that pypiwin32 package has not been installed in your PC.Please use pip to install this package like executing the following command in your computer:
pip install pypiwin32

Related

ansible-container docker.errors.DockerException: Error while fetching server API version

I am trying to build a container using ansible-container module on my Mac and running into the following issue.
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible-container build --roles-path=/Users/karthikjayaraman/roles
Building Docker Engine context...
Starting Docker build of Ansible Container Conductor image (please be patient)...
Parsing conductor CLI args.
Docker™ daemon integration engine loaded. Build starting. project=infrastructure
Building service... project=infrastructure service=mdcsat
Traceback (most recent call last):
File "/usr/bin/conductor", line 11, in <module>
load_entry_point('ansible-container', 'console_scripts', 'conductor')()
File "/_ansible/container/__init__.py", line 19, in __wrapped__
return fn(*args, **kwargs)
File "/_ansible/container/cli.py", line 399, in conductor_commandline
**params)
File "/_ansible/container/__init__.py", line 19, in __wrapped__
return fn(*args, **kwargs)
File "/_ansible/container/core.py", line 700, in conductorcmd_build
cur_image_id = engine.get_image_id_by_tag(service['from'])
File "/_ansible/container/docker/engine.py", line 549, in get_image_id_by_tag
image = self.client.images.get(tag)
File "/_ansible/container/docker/engine.py", line 164, in client
self._client = docker.from_env(version='auto', timeout=timeout)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 80, in from_env
**kwargs_from_env(**kwargs))
File "/usr/lib/python2.7/site-packages/docker/client.py", line 37, in __init__
self.api = APIClient(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 147, in __init__
self._version = self._retrieve_server_version()
File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 174, in _retrieve_server_version
'Error while fetching server API version: {0}'.format(e)
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))
Conductor terminated. Cleaning up. command_rc=1 conductor_id=6a4f7bcb46a33b8053d22af2ecc17abaa84abddf99f80f133b921546d36c76fc save_container=False
ERROR Conductor exited with status 1
The build numbers of the components are as follows:
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible --version
ansible 2.6.1
config file = /Users/karthikjayaraman/mdc/mdc/tools/infrastructure/ansible.cfg
configured module search path = [u'/Users/karthikjayaraman/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Python/2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.10 (default, Oct 6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ docker --version
Docker version 18.03.1-ce, build 9ee9f40
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ ansible-container version
Ansible Container, version 0.9.2
Docker on my Mac is installed and running well.
Karthiks-MacBook-Pro:infrastructure karthikjayaraman$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Any help appreciated !.
Are you sure, you added your user account to the docker group? (your = account you run ansible-container under)
See here: https://docs.docker.com/engine/installation/linux/linux-postinstall/

IoT Azure Edge ContextualVersionConflict: pyOpenSSL

I am following the Quickstart Azure IoT Edge tutorial and in the Section Configure the IoT Edge runtime.
When I configure the runtime with the IoT Edge device connection string
iotedgectl setup --connection-string "{device connection string}" --nopass
(I changed the connection string) I get the following result
Traceback (most recent call last):
File "/usr/local/bin/iotedgectl", line 11, in <module>
sys.exit(coremain())
File "/Library/Python/2.7/site-packages/edgectl/__init__.py", line 23, in coremain
version = pkg_resources.require(PACKAGE_NAME)[0].version
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 959, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 851, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pyOpenSSL 0.13.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('pyOpenSSL>=0.14'), set(['docker']))
That does not allow me to continue with the command
iotedgectl start
I looked at the file init.py From line 857-859 There is:
# Register the new requirements needed by req
for new_requirement in new_requirements:
required_by[new_requirement].add(req.project_name)
Lines 848 - 851
if dist not in req:
# Oops, the "best" so far conflicts with a dependency
dependent_req = required_by[req]
raise VersionConflict(dist, req).with_context(dependent_req)
Line 959
needed = self.resolve(parse_requirements(requirements))
What do I need to change there? Or what needs to be configured?
Before installing iotedgectl, you already have a lower version of pyOpenSSL installed, which does not meet iotedgectl's version requirement but precedes the higher version of pyOpenSSL installed along with iotedgectl.
You can check out this answer to learn how to make Python reference the higher version of pyOpenSSL first.
In addition, it seems that you are working on macOS. If so, please refer to Quickstart: Deploy your first IoT Edge module to a Linux or Mac device - preview, instead of Quickstart: Deploy your first IoT Edge module from the Azure portal to a Windows device - preview.
From the message,it shows that the pyOpenSSL is too old, it needs 0.14 or later.
Traceback (most recent call last):
File "/usr/local/bin/iotedgectl", line 11, in <module>
sys.exit(coremain())
File "/Library/Python/2.7/site-packages/edgectl/__init__.py", line 23, in coremain
version = pkg_resources.require(PACKAGE_NAME)[0].version
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py",
line 959, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py",
line 851, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pyOpenSSL 0.13.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python),
Requirement.parse('pyOpenSSL>=0.14'), set(['docker']))
You can use the following command to upgrade the pyOpenSSL:
pip install --upgrade pyOpenSSL
If the problem can not be resolved, please feel free to let me know.

Running Gramex on new Ubuntu 16.04 Installation

I'm having trouble running gramex in Ubuntu 16.04.
Running it inside docker works fine, which leads me to suspect that I'm missing some dependency, but can't seem to figure out which one.
This is the error that I get, any ideas?
INFO 22-Mar 11:33:21 install Gramex 1.31.0 | guide --browser=/welcome | /gramex/apps/guide | Python 3.6.4 |Anaconda, Inc.| (default, Mar 13 2018, 01:15:57) [GCC 7.2.0]
WARNING 22-Mar 11:33:21 config Missing config: /.config/gramexdata/mail/gramexmail.yaml
WARNING 22-Mar 11:33:21 watcher watch directory /.config/gramexdata/mail does not exist
INFO 22-Mar 11:33:21 config No config found: /.config/gramexdata/mail/gramexmail.yaml
Traceback (most recent call last):
File "/anaconda3/envs/gramex/bin/gramex", line 11, in <module>
sys.exit(commandline())
File "/anaconda3/envs/gramex/lib/python3.6/site-packages/gramex/__init__.py", line 172, in commandline
callback(**kwargs)
File "anaconda3/envs/gramex/lib/python3.6/site-packages/gramex/install.py", line 539, in run
gramex.init(cmd=AttrDict(app=app_config['run']))
File "anaconda3/envs/gramex/lib/python3.6/site-packages/gramex/__init__.py", line 279, in init
callback = getattr(services, key)(conf[key])
File "anaconda3/envs/gramex/lib/python3.6/site-packages/gramex/services/__init__.py", line 133, in app
if ioloop._running:
AttributeError: 'AsyncIOMainLoop' object has no attribute '_running'
Gramex 1.31 is not compatible with Tornado 5.0. This will be resolved in Gramex 1.32, which is due on 31 Mar 2018, and is tracked here

Running html5 app template in ubuntu sdk failed?

My configuration :
Ubuntu 14.04 LTS
64bit
Qtcreator 3.1.1
everything is up-to-date
Hello everyone,
I'm trying to just compile and run an HTML5 App for ubuntu Phone, but after trying and searching for a week now, I still can't make it run !
For the moment I just want to run the simple html5 app template.
This is the situation :
I have installed ubuntu sdk as instructed in https://developer.ubuntu.com/en/start/ubuntu-sdk/installing-the-sdk/
I've created in the run click menu, an i386 build target. (15.04) --- which exited with no errors
I created an i386 emulator in devices --> i386 - devel - default password --- which is finally up and running correctly
The problem is when I compile the default template : theses are the errors I get :
desktop_Exec(app): found unexpected Exec with architecture 'all':./qtc_device_debughelper.py
security_policy_groups_safe_app(debug):(REJECT)reserved policy group 'debug':not for production use
security_policy_version_matches_framework(app.apparmor):invalid framework 'ubuntu-core-15.04'
And when I try to edit it anyway :
This is what I get :
Traceback (most recent call last):
File "/tmp/qtc_device_applaunch.py", line 29, in <module>
gi.Repository.get_default().require("UbuntuAppLaunch")
gi.RepositoryError: Typelib file for namespace 'UbuntuAppLaunch' (any version) not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2158, in _find_spec
AttributeError: 'DynamicImporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/qtc_device_applaunch.py", line 33, in <module>
from gi.repository import UpstartAppLaunch as UAL
File "/usr/lib/python3/dist-packages/gi/importer.py", line 53, in find_module
'introspection typelib not found' % namespace)
ImportError: cannot import name UpstartAppLaunch, introspection typelib not found
I have been looking for this everywhere but I couldn't find something that works.
I need some of your knowledge to help me understand all this!
I have the same errors. I think that the 'ubuntu-core-15.04'-error is related to the version of Ubuntu you are using. I use Mint 17, which is based on Ubuntu 14.04. Canonical recommends the newer Ubuntu Versions for app-developing, because there is some stuff in it they changed.
unfortunately, I can't help you with the other errors.

Build fail after updating to Mountain Lion

Traceback (most recent call last): File "./Scripts/version.py", line 6, in <module>
from Foundation import NSMutableDictionary File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/Foundation/__init__.py", line 8, in <module>
import objc as _objc File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/__init__.py", line 30, in <module>
from objc._bridgesupport import * File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_bridgesupport.py", line 9, in <module>
import pkg_resources File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 698, in <module>
class Environment(object): File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 701, in Environment
def __init__(self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 96, in get_supported_platform
plat = get_build_platform(); m = macosVersionString.match(plat) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 222, in get_build_platform
plat = get_platform() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/util.py", line 98, in get_platform File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/sysconfig.py", line 498, in get_config_vars File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/sysconfig.py", line 407, in _init_posix distutils.errors.DistutilsPlatformError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.7" but "10.8" during configure Command /bin/sh failed with exit code 1
I'm using python script for version control to TestFlight. While building I get some error. I don't know anything about python. What's the problem here?
XCode Version: 4.4
OS: Mountain Lion 10.8
MacBook PRO mid2009
This appears to be the key part of the message:
$MACOSX_DEPLOYMENT_TARGET mismatch: now "10.7" but "10.8" during
configure
Whatever toolset you are using was configured under Mountain Lion but is now running under Lion, and yet you claim the opposite.
You don't specify what toolset you are using, but it looks like you are going to have to set it up again under your new O/S.
It's a little wonky, but if you edit your .bash_profile and add:
export MACOSX_DEPLOYMENT_TARGET=10.8
You should be okay. I had this same problem when trying to run post-review.
I found the solution, go into your /System/Library/Frameworks/Python.framework/Versions/2.7/lib/distutils/sysconfig.py
Goto line 408 that says "raise DistutilsPlatformError" and add a '#' to comment out that line of code... This will "unleash the python"
You are basically telling python "don't worry its not 10.7, I know" there could be some crashes as a result but I think otherwise. My very complex python applicaiton now compiles on MacOSX 10.8 with no troubles and it seems to do the job, QA still has to test it though.
I am on MacBookPro 2012 MacOSX 10.8

Resources