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

Unable to use azure SDKs with python #164

Closed
jeffhollan opened this Issue Jul 25, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@jeffhollan
Member

jeffhollan commented Jul 25, 2018

Created a vanilla HTTP function (works):

import logging

import azure.functions as func

def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    return func.HttpResponse('Hello', status_code=200)

I then installed the Azure SDK

pip install azure

When I try to reference one of these SDKs it throws errors for naming conficts

import azure.mgmt.compute
import azure.mgmt.network.models
import azure.mgmt.storage.models
[7/25/18 8:30:37 PM]     import azure.functions  # NoQA
[7/25/18 8:30:37 PM] ModuleNotFoundError: No module named 'azure.functions'
@elprans

This comment has been minimized.

Collaborator

elprans commented Jul 28, 2018

I need a bit more context please. How was the python worker installed?

@jeffhollan

This comment has been minimized.

Member

jeffhollan commented Jul 28, 2018

Just following the quickstart here

@jeffhollan

This comment has been minimized.

Member

jeffhollan commented Jul 28, 2018

Link didn’t work but it’s the “create function via CLI” one

@elprans

This comment has been minimized.

Collaborator

elprans commented Jul 28, 2018

Which version of core tools are you running?

@ahmelsayed can you confirm that we do not use the development mode install for the python worker (pip install -e) in the core tools script?

@asavaritayal

This comment has been minimized.

Collaborator

asavaritayal commented Jul 29, 2018

@jeffhollan what is the version of the core tools you're using? Can you also share your requirements.txt file?

@jeffhollan

This comment has been minimized.

Member

jeffhollan commented Aug 6, 2018

Tested this on latest func cli and it's working now so can close. As any FYI my requirements.txt when not working had this:

-e git+https://github.com/Azure/azure-functions-python-worker.git@57a4dda497c4cde83288f010fef490ff9a42edb7#egg=azure_functions_python

But now has this

azure-functions==1.0.0a1
azure-functions-worker==1.0.0a3

@jeffhollan jeffhollan closed this Aug 6, 2018

@rvanmaanen

This comment has been minimized.

rvanmaanen commented Aug 7, 2018

I actually ran into this reference to GitHub too, had issues when publishing when this was still in the requirement.txt file. Wrote something about it here, where I was struggling as well.

Maybe someone can explain why it is setup like this and not just a normal reference as Jeff says here as well?

Update: Apparently this is already changed in the latest version of the cli. Just created a new function and my requirements are now listed as:

azure-functions==1.0.0a1 azure-functions-worker==1.0.0a3 grpcio==1.12.1 grpcio-tools==1.12.1 protobuf==3.6.0 six==1.11.0

@asavaritayal

This comment has been minimized.

Collaborator

asavaritayal commented Aug 7, 2018

@rvanmaanen thanks for blogging about this! Just ran through your post and most of the rough edges you ran into earlier should now be fixed. Let us know about your experience when you give it a shot next. Happy to connect further on any feedback and recommendations you might have :)

PS Python on v2 is not yet officially supported hence it's not mentioned on the docs. We're treating the feature as still in-development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment