Closed raygervais closed 5 years ago
Hi @raygervais - it looks like you have the Azure CLI installed - however this does not currently include the package azure-eventhub that is used by the documentation you linked to.
Did you try running the installation command?
pip install azure-eventhub
If so - it may have installed to a different Python version then that used by the CLI that we're seeing in the output above.
Hi @annatisch, attempting to install results in a few errors (in order along with their fix), and though I am happy to help fix them, I wonder if there a Docker image which already has this setup officially by Microsoft / Azure?
All Errors relate to microsoft/azure-cli:latest
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4xo0sdxd/uamqp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-czuiv9p9-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-4xo0sdxd/uamqp/
You are using pip version 9.0.3, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Running the suggested command upgrades the version successfully, and produces this error message when trying pip install azure-eventhub
again:
----------------------------------------
Failed building wheel for uamqp
Running setup.py clean for uamqp
Failed to build uamqp
Installing collected packages: uamqp, azure-eventhub
Running setup.py install for uamqp ... error
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-g5cpyzbn/uamqp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-fq4n4aom/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/uamqp
copying uamqp/sender.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/session.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/compat.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/utils.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/message.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/types.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/address.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/receiver.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/client.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/constants.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/connection.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/__init__.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/mgmt_operation.py -> build/lib.linux-x86_64-3.6/uamqp
copying uamqp/errors.py -> build/lib.linux-x86_64-3.6/uamqp
creating build/lib.linux-x86_64-3.6/uamqp/authentication
copying uamqp/authentication/common.py -> build/lib.linux-x86_64-3.6/uamqp/authentication
copying uamqp/authentication/cbs_auth_async.py -> build/lib.linux-x86_64-3.6/uamqp/authentication
copying uamqp/authentication/cbs_auth.py -> build/lib.linux-x86_64-3.6/uamqp/authentication
copying uamqp/authentication/__init__.py -> build/lib.linux-x86_64-3.6/uamqp/authentication
creating build/lib.linux-x86_64-3.6/uamqp/async_ops
copying uamqp/async_ops/connection_async.py -> build/lib.linux-x86_64-3.6/uamqp/async_ops
copying uamqp/async_ops/receiver_async.py -> build/lib.linux-x86_64-3.6/uamqp/async_ops
copying uamqp/async_ops/client_async.py -> build/lib.linux-x86_64-3.6/uamqp/async_ops
copying uamqp/async_ops/sender_async.py -> build/lib.linux-x86_64-3.6/uamqp/async_ops
copying uamqp/async_ops/mgmt_operation_async.py -> build/lib.linux-x86_64-3.6/uamqp/async_ops
copying uamqp/async_ops/__init__.py -> build/lib.linux-x86_64-3.6/uamqp/async_ops
copying uamqp/async_ops/session_async.py -> build/lib.linux-x86_64-3.6/uamqp/async_ops
running egg_info
writing uamqp.egg-info/PKG-INFO
writing dependency_links to uamqp.egg-info/dependency_links.txt
writing requirements to uamqp.egg-info/requires.txt
writing top-level names to uamqp.egg-info/top_level.txt
reading manifest file 'uamqp.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'uamqp.egg-info/SOURCES.txt'
copying uamqp/c_uamqp.c -> build/lib.linux-x86_64-3.6/uamqp
running build_ext
will build uamqp in build/temp.linux-x86_64-3.6/cmake
Building with generator: Unix Makefiles
calling cmake /tmp/pip-install-g5cpyzbn/uamqp/src/vendor/azure-uamqp-c/ -G "Unix Makefiles" -Duse_openssl:bool=ON -Duse_default_uuid:bool=ON -Duse_builtin_httpapi:bool=ON -Dskip_samples:bool=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release
/bin/sh: cmake: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-g5cpyzbn/uamqp/setup.py", line 328, in <module>
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/local/lib/python3.6/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-g5cpyzbn/uamqp/setup.py", line 167, in run
self.build_cmake(ext)
File "/tmp/pip-install-g5cpyzbn/uamqp/setup.py", line 215, in build_cmake
subprocess.check_call(joined_cmd, shell=True, universal_newlines=True, env=build_env)
File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'cmake /tmp/pip-install-g5cpyzbn/uamqp/src/vendor/azure-uamqp-c/ -G "Unix Makefiles" -Duse_openssl:bool=ON -Duse_default_uuid:bool=ON -Duse_builtin_httpapi:bool=ON -Dskip_samples:bool=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release' returned non-zero exit status 127.
----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-g5cpyzbn/uamqp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-fq4n4aom/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-g5cpyzbn/uamqp/
Thoughts? Again, happy to get this resolved and working for those who want to use in AzureCLI as well, but really need a working Docker image to use during that time.
To your last comment, is there a specific directory for the AzureCLI / Python SDK version that I should be executing against?
Thanks @raygervais! We do not currently have a Docker container with azure-eventhub set up. But this is an interesting idea that I will look into - as it could also be useful for our test infrastructure....
Though in the meantime, it's interesting that it looks like it's attempting to build uAMQP from source. Could you try updating pip? Maybe the older version of pip is not picking up the uAMQP wheel. The alternative is that your Linux distro does not like the published manylinux wheel..... which Linux distro are you currently running?
python -m pip install --upgrade pip
Update for you @annatisch, updated pip using your supplied command above, but it appears to have the same error. The official microsoft/azure-cli
Docker image is using the following Linux distro: Alpine Linux 3.7.0
.
Dockerfile: https://github.com/Azure/azure-cli/blob/master/Dockerfile
I know Alpine has a common issue with building tooling due to it's minimalistic nature, so I'd be curious to try on an Ubuntu 18.04 LTS
Dockerfile (based off of what is already done in the Dockerfile above). Thoughts?
Would love to hear about your test infrastructure too at one point, always open to learning and help to improve my own work alongside the communities.
Update: Also tried on azuresdk/azure-cli-python:latest
, same issue. What is the difference between microsoft/azure-cli
and the above?
Wanted to provide an update/working solution using Debian Stretch
, but there is still the ask of Alpine
.
Dockerfile
FROM python:slim-stretch
# Install Azure Event Hub PythonSDK Module
RUN pip install azure-eventhub
# Remove Unneeded PIP Cache after Install
RUN rm -rf /.cache
Installs as expected, the average image size is 185MB, hence my wanting to get the Alpine
variant working.
Hi @raygervais - yes you're quite right - Alpine is not supported by manylinux, so we do not currently have a wheel available for uAMQP for that distro.
You could try out the instructions here to see whether it's possible to build uAMQP from source for Alpine: https://github.com/Azure/azure-uamqp-python/blob/master/README.rst#installation
Otherwise I have opened an issue here and I will try to take a look at getting wheel support: https://github.com/Azure/azure-uamqp-python/issues/51
Will try @annatisch the suggestion instructions, thanks for opening the issue in the uampq-python repository! Looking forward to getting this resolved and enabling other developers both Microsoft and alike to utilize the Azure-EventHub
Python module in Alpine Docker containers.
apk add g++
seemed to at least fix a cmake
error in Alpine 3.9 for a build from source
Closing due to inactivity - alpine support issue will remain open in uamqp.
Adding these four lines on docker file solved my issue
Find arm64 variant of deb buster
RUN echo "deb http://deb.debian.org/debian buster main" > /etc/apt/sources.list \
&& echo "deb http://deb.debian.org/debian buster/updates main" >> /etc/apt/sources.list \
&& echo "deb http://deb.debian.org/debian buster-updates main" >> /etc/apt/sources.list \
&& apt-get --quiet update --yes && apt-get --quiet upgrade --yes \
&& apt-get install -y build-essential libssl-dev uuid-dev cmake libcurl4-openssl-dev pkg-config
Trying to setup a basic EventsHub POC following the documentation provided here: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-python-get-started-receive
Python Import:
from azure.eventhub import EventHubClient, Receiver, Offset
Error:
Latest Container Version(s)