question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dependencies ERROR in publishing Python functions with func command

See original GitHub issue

I cannot publish Python functions with func command as I get the following dependencies ERROR.

Errors & Repro steps:

ERRORS

There was an error restoring dependencies.ERROR: cannot install vsts-cd-manager-1.0.2 dependency: binary dependencies without wheels are not support ed. Use the --build-native-deps option to try building the binary dependencies using a Docker container.

Here are repo steps:

First of all, I tried to publish my functions with the following command:

$ func azure functionapp publish yoichikaazfuncv2linux001

...snip...
pip download --no-deps --only-binary :all: --platform manylinux1_x86_64 --python-version 36 --implementation cp --abi cp36m --dest /var/folders/mn/x
w3hp_854lvb5yr2m_00s7sm0000gn/T/azureworker50__fe6_ azure_cli_servicebus==0.3.2
pip download --no-deps --only-binary :all: --platform manylinux1_x86_64 --python-version 36 --implementation cp --abi cp36m --dest /var/folders/mn/x
w3hp_854lvb5yr2m_00s7sm0000gn/T/azureworker50__fe6_ vsts-cd-manager==1.0.2
pip wheel --no-deps --no-binary :all: --wheel-dir /var/folders/mn/xw3hp_854lvb5yr2m_00s7sm0000gn/T/azureworker9wckbkc4 vsts-cd-manager==1.0.2

There was an error restoring dependencies.ERROR: cannot install vsts-cd-manager-1.0.2 dependency: binary dependencies without wheels are not support
ed.  Use the --build-native-deps option to try building the binary dependencies using a Docker container.

Then, as instructed by error message, I tried to publish my functions with --build-native-deps option. However I still got an error

$ func azure functionapp publish yoichikaazfuncv2linux001 --build-native-deps

...snip...
pip download --no-deps --only-binary :all: --platform manylinux1_x86_64 --python-version 36 --implementation cp --abi cp36m --dest /var/folders/mn/x
w3hp_854lvb5yr2m_00s7sm0000gn/T/azureworker50__fe6_ vsts-cd-manager==1.0.2
pip wheel --no-deps --no-binary :all: --wheel-dir /var/folders/mn/xw3hp_854lvb5yr2m_00s7sm0000gn/T/azureworker9wckbkc4 vsts-cd-manager==1.0.2

    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 784, in build
    exec(text, spec_namespace)
  File "<string>", line 17, in <module>
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 241, in __init__
    self.__postinit__()
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 500, in assemble
    module_hook.post_graph()
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/building/imphook.py", line 410, in post_graph
    self._load_hook_module()
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/building/imphook.py", line 377, in _load_hook_module
    self.hook_module_name, self.hook_filename)
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/compat.py", line 736, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/hooks/hook-cryptography.py", line 23, in <module>
    datas = copy_metadata('cryptography')
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/PyInstaller/utils/hooks/__init__.py", line 859, in copy_metadata
    dist = pkg_resources.get_distribution(package_name)
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 472, in get_distribution
    dist = get_provider(dist)
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 344, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 778, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'cryptography' distribution was not found and is required by the application

Environment information

  • Function App name: yoichikaazfuncv2linux001
  • OS: macOS 10.14.1 (18B75) Kernel Version: Darwin 18.2.0
  • Python version: Python 3.6.5
  • func version: 2.1.748 . (azure-functions-core-tools@2.1.748)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
asavaritayalcommented, Nov 14, 2018

Thanks @ankitkumarr ! I tried again and was able to successfully publish using the same requirements as before.

@yokawasa I’m closing the issue for now. Please feel free to re-open if you still see any issues. Thanks for trying this feature in preview.

1reaction
ankitkumarrcommented, Nov 13, 2018

Hi,

This issue (similar to https://github.com/Azure/azure-functions-core-tools/issues/826) was fixed in https://github.com/Azure/azure-functions-core-tools/pull/850.

A new release of azure-functions-core-tools should be out soon with the fix in it.

Please let me know if you still see the problem after the new release.

UPDATE: azure-functions-core-tools version 2.2.32 was released today. This release should have the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Python errors in Azure Functions - Microsoft Learn
Go to your local function project folder, and use func azure functionapp publish <app-name> --build-native-deps for deployment.
Read more >
Attempt to publish Azure Function App (python) fails with ...
docker run -d mcr.microsoft.com/azure-functions/python docker exec ... To fix this problem, try to delete unused stopped docker containers.
Read more >
Deploy Python Lambda functions with .zip file archives
Deployment package with dependencies · Open a command prompt and create a my-sourcecode-function project directory. · Navigate to the my-sourcecode-function ...
Read more >
Packaging and distributing projects
This section covers some additional details on configuring, packaging and distributing Python projects with setuptools that aren't covered by the introductory ...
Read more >
Dependency Management With Python Poetry
When your Python project relies on external packages, you need to make sure you're using the right version of each package. After an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found