Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32 wheel package suitable for Azure Functions #1044

Closed
flamby opened this issue Mar 21, 2017 · 19 comments
Closed

win32 wheel package suitable for Azure Functions #1044

flamby opened this issue Mar 21, 2017 · 19 comments
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Packaging

Comments

@flamby
Copy link

flamby commented Mar 21, 2017

Hi,

Currently, I was not able to install the sdk in Azure Functions.
It seems some dependencies like cffi needs Visual C++.
Error message :

  File "D:\home\site\wwwroot\QueueTriggerPython2\env\lib\site-packages\setuptools\msvc9_support.py", line 61, in query_vcvarsall

    message + ' Get it from http://aka.ms/vcpython27'

distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27

Could you provide win32 wheel packages suitable for Azure Functions?
i.e. azure sdk and its dependencies wheel packages

TIA

@lmazuel
Copy link
Member

lmazuel commented Mar 21, 2017

Hi @flamby
When you say "install the SDK", what package do you need exactly?
Thanks,

@flamby
Copy link
Author

flamby commented Mar 21, 2017

Hi @lmazuel
I would say all of them as I don't know their internal dependencies. Those installed by
pip install azure --pre

but what I need for now is dealing w/ VM and network stuff (VNET, NIC, VNG), so basic stuff.

@lmazuel
Copy link
Member

lmazuel commented Mar 21, 2017

I don't deny the issue, you're not the first and we are working on it. I was just thinking about help you asap versus help you in the long term. Because azure is a meta-package that does not contain code itself. By choosing carefully what version of real packages you install, you might be able to workaround the issue right now.
So short term, what do need exactly? Compute? Storage? etc.

Be sure I won't close the issue before I'm sure this works out of the box for everybody, but this does not imply that we won't try to make it work right now :)

@lmazuel lmazuel added bug This issue requires a change to an existing behavior in the product in order to be resolved. Packaging labels Mar 21, 2017
@lmazuel
Copy link
Member

lmazuel commented Mar 21, 2017

Related issue: Azure/azure-storage-python#219

@flamby
Copy link
Author

flamby commented Mar 21, 2017

The workaround for python 2.7, based on issue 219 of azure-storage-python :

  1. mkdir wheelhouse
  2. download cffi official whl, rename it to cffi-1.10.0-cp27-none-win32.whl and upload it to the directory
  1. download cryptography official whl, rename it to cryptography-1.8.1-cp27-none-win32.whl and upload it to the directory
  1. download pycrypto official whl and upload it to the directory
  1. requirements.txt
--find-links wheelhouse
cffi==1.10.0
cryptography==1.8.1
pycrypto==2.6.1
azure==2.0.0rc6
  1. pip install -r requirements.txt
    That's it for azure sdk installation!

So most wheel package installation issues come from this ABI tag in the wheel package name.

You must install msrestazure package too, which requires keyring, then adal, then jwt (0.3.2 for python 2.7!). All of them don't install well w/ pip on windows.
So using kudu, I had to drag & drop their source folder in the site-packages folder of the python runtime (or virtualenv) to solve the problem. So no need of whl files for them since they don't require compilation at all.

@lmazuel
Copy link
Member

lmazuel commented Mar 21, 2017

Thanks for all the details @flamby !
msrestazure is more than login, it's the entire RestAPI connection layer. What kind of issue do you have with keyring?

@lmazuel
Copy link
Member

lmazuel commented Mar 21, 2017

I just tested and have no issue installing keyring, could you share the error you have?

@silencev
Copy link

@flamby
I'm not sure if you are install packages in build-in Python of Azure Function App.
but I did not experience this issue in Function App.

  1. I installed Python 3.5.2 via Kudu site extensions.
  2. Navigate to directory D:\home\Python35
  3. using Kudu cmd line to install packages:
python.exe -m pip install -r requirements.txt

here is my package list in requirements.txt:

setuptools==34.0.1
azure==2.0.0rc6
azure-keyvault==0.1.0
azure-storage==0.33.0
azure-mgmt-dns==1.0.0
azure-mgmt-servicebus==0.1.0
azure-mgmt-web==0.31.0
applicationinsights==0.10.0
msrest==0.4.4
msrestazure==0.4.7
pymongo==3.4.0

@flamby
Copy link
Author

flamby commented Mar 22, 2017

@silencev I'm using python 2.7 (default one).

I guess all this pip / wheel mess is fixed in python 3.x

@lmazuel did you test w/ python 2.7?
keyring pip installation went well, but loading module did not. i suspect it's due to the module installed as an egg file, instead of a directory. probably fixed also in 3.x, but I need 2.7 for some modules.

@lmazuel
Copy link
Member

lmazuel commented Mar 22, 2017

@silencev in Azure Functions you can't override Python yet

@flamby Your packages are tested in Py2.7, but maybe pip is old enough so keyring is not installed from the wheel. could you try to update pip and see what happen? I will check too now I know it's runtime and not installation.

@lmazuel
Copy link
Member

lmazuel commented Mar 22, 2017

@flamby

I make it work:
image

So, I followed your instructions, but you need first to update pip to latest one (I have 9.0.1 installed in my venv now). This will take care of keyring and latest azure packages. This might be enough as well to avoid your "none renaming" issue, need to try it.

Also in this test I installed directly azure-mgmt-resource and I used ADAL, but I have no reason to believe you can't use any authentication you want.

FYI @zooba @brettcannon

@lmazuel
Copy link
Member

lmazuel commented Mar 22, 2017

@flamby

Actually, I just tested and pip upgrade is enough. So:

  • Create a virtualenv and load it
  • Update pip pip install -U pip
  • Install the SDK as usual

No rename or manual download :)

@flamby
Copy link
Author

flamby commented Mar 23, 2017

@lmazuel good to know! should be documented then ;-)
as I'm running out of credits, i won't be able to test it yet.

@flamby
Copy link
Author

flamby commented Apr 9, 2017

@lmazuel indeed. I was finally able to test it and it works like a charm. thanks!

@4c74356b41
Copy link
Contributor

@lmazuel this doesnt really work terribly reliably, right? this wont scale or if the host changes this will need manual intervention?

@lmazuel
Copy link
Member

lmazuel commented May 1, 2018

A v2 of Azure Functions is coming for Python:
https://docs.microsoft.com/en-us/azure/azure-functions/supported-languages#languages-in-runtime-1x-and-2x

For the first examples I saw in Python v2, this kind of trouble will disapear.

@4c74356b41
Copy link
Contributor

@lmazuel do you know the timeline? also, that article doesnt list python as available for 2.0...

@lmazuel
Copy link
Member

lmazuel commented May 2, 2018

I said "is coming", so no, not available ;)
No, I don't know the timeline. You can probably ask here:
https://github.com/Azure/azure-functions-python-worker

This is the future v2 library available from Azure Functions for Python

@4c74356b41
Copy link
Contributor

well, the article you linked doesnt support your claim in any way (i'm not saying you are wrong, i'm just saying that I dont see any evidence in that article that supports your claim). thanks @lmazuel

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Packaging
Projects
None yet
Development

No branches or pull requests

4 participants