'Error when deploying app on azure app service

I get this error message when I deploy my app from github to the azure app service.

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [16 lines of output] Package libparted was not found in the pkg-config search path. Perhaps you should add the directory containing `libparted.pc' to the PKG_CONFIG_PATH environment variable No package 'libparted' found Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-duf5fzoq/pyparted_8a4ebfd316a743d7b84f7e1e0c77cc80/setup.py", line 60, in check_mod_version('libparted', need_libparted_version) File "/tmp/pip-install-duf5fzoq/pyparted_8a4ebfd316a743d7b84f7e1e0c77cc80/setup.py", line 54, in check_mod_version modversion = subprocess.check_output(["pkg-config", "--modversion", module]).decode('utf-8').split()[0] File "/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/opt/hostedtoolcache/Python/3.9.12/x64/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['pkg-config', '--modversion', 'libparted']' returned non-zero exit status 1. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

enter image description here



Solution 1:[1]

This is most likely because you have not installed the package. There are several ways to do this but the easiest is to install via the Kudu console. The Kudu console gives you direct, elevated command-line access to the App Service server and its file system. This is both a valuable debugging tool and allows for CLI operations such as installing packages.

How to open Kudu Debug Console

Use python.exe -m pip install <package_name> to install a package.

How to manually add python package

Full Instructions are here: https://docs.microsoft.com/en-us/visualstudio/python/managing-python-on-azure-app-service?view=vs-2022#azure-app-service-kudu-console

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ken W MSFT