azure-functions-core-tools: distlib dependency is throwing an error during publish

From @asavaritayal on September 13, 2018 23:16

I get the following error on publishing an app with the following dependencies -

> func azure functionapp publish astaycustomerchurnapp --force

There was an error restoring dependencies.ERROR: ['pip', 'download', '-r', '/Users/asavaritayal/customer-churn-prediction/requirements.txt', '--dest', '/var/folders/3v/hjcbc73d5t373f24vgrh8ny40000gn/T/azureworkersp1rpvrl'] failed with exit code 1

Here is my requirements.txt :

azure-functions==1.0.0a4
azure-functions-worker==1.0.0a4
distlib==0.2.8.dev0
grpcio==1.14.2
grpcio-tools==1.14.2
numpy==1.15.1
pandas==0.23.4
protobuf==3.6.1
python-dateutil==2.7.3
pytz==2018.5
scikit-learn==0.18.1
scipy==1.1.0
six==1.11.0

Everything works locally so not sure what the issue is.

Copied from original issue: Azure/azure-functions-python-worker#197

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (22 by maintainers)

Commits related to this issue

Most upvoted comments

I don’t think we have to worry about this one. I’ll merge your PR

I think maybe even simpler approach without modifying the environment variable would be to put packapp.py in a directory (perhaps packapp) and rename it to __main__.py. We could then download distlib in the same directory (packapp) under the directory distlib and expand it (such that distlib’s __init__.py is directory under directory packapp/distlib).

The structure would be like- . |---- packapp/             |---- __main__.py (packapp code)             |---- distlib/                         |---- __init__.py (distlib’s code)                         |---- … (distlib’s code)

With this configuration, we can simply run python packapp [args] and it should work! I think ideally we should do this when we build the azure-functions-core-tools project. But for now, we can either change our pip command to achieve this or simply put it like this in the repo.

@elprans - would love to hear your thoughts and if you know the best change to the pip command for this?

This requirements.txt is failing specifically because of distlib==0.2.8.dev0 on line 3. The version number is incorrect. @asavaritayal mentioned that she hadn’t specifically added that package.

Investigating the code in PythonHelpers.cs , var exe = new Executable("pip", "install -U git+https://github.com/vsajip/distlib.git@15dba58a827f56195b0fa0afe80a8925a92e8bf5");
This installs distlib version specified by a commit id.

So, when someone executes pip freeze > requirements.txt, the installed package represented by distlib==0.2.8.dev0 gets added in the requirements.txt.

Trying, pip install distlib==0.2.8.dev0 will show that no such version of distlib exists (because that was installed by versioning a specific commit).

I am guessing we do need distlib’s specified version to be there? @elprans would you know?