1

I am trying to deploy python flask web api to azure portal but getting issues with dependency installation as the figure below. enter image description here

I have already added extension -Python 3.5.4 x64 to my azure web app and also using latest version for all dependencies as you can see in requirements.txt file.

enter image description here Can anyone help?

Also I have tried this- installing/upgrading setuptools from Azure Kudu DebugConsole, but that is resulting in access denied issue.

Kudu Remote Execution Console
Type 'exit' then hit 'enter' to get a new CMD process.
Type 'cls' to clear the console

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

D:\home>pip install -U setuptools
'pip' is not recognized as an internal or external command,
operable program or batch file.

D:\home>python -m pip install -U setuptools
Downloading/unpacking setuptools from https://files.pythonhosted.org/packages/e7/16/da8cb8046149d50940c6110310983abb359bbb8cbc3539e6bef95c29428a/setuptools-40.6.2-py2.py3-none-any.whl#sha256=88ee6bcd5decec9bd902252e02e641851d785c6e5e75677d2744a9d13fed0b0a
Installing collected packages: setuptools
  Found existing installation: setuptools 2.1
    Uninstalling setuptools:
Cleaning up...
Exception:

Traceback (most recent call last):
  File "D:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "D:\Python34\lib\site-packages\pip\commands\install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "D:\Python34\lib\site-packages\pip\req.py", line 1431, in install
    requirement.uninstall(auto_confirm=True)
  File "D:\Python34\lib\site-packages\pip\req.py", line 598, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "D:\Python34\lib\site-packages\pip\req.py", line 1836, in remove
    renames(path, new_path)
  File "D:\Python34\lib\site-packages\pip\util.py", line 295, in renames
    shutil.move(old, new)
  File "D:\Python34\lib\shutil.py", line 535, in move
    os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'd:\\python34\\lib\\site-packages\\__pycache__\\easy_install.cpython-34.pyc'

Storing debug log for failure in D:\home\pip\pip.log
Peter Pan
  • 23,476
  • 4
  • 25
  • 43
Radhika Patwari
  • 131
  • 1
  • 6

1 Answers1

0

On Azure WebApps, you have no permission to do any write operation under the path D:\ except D:\home. So when you want to install pip for default python runtime which be in D:\Python34, it will cause the error PermissionError Access is denied.

The only way is to install a Python site extension via Kudo and configure web.config to use it instead of the default one. There is an answer of an existing SO thread Why is the azure app service django deploy keep failing? which introduces the installation that you can refer to to resolve it.

And now, I see you have installed this extension, but the python command you called is still the default one. The solutions are as below.

  1. Change the environment variable path via the command set PATH=D:\home\Python34;%PATH% to cover the default one.
  2. Change the current directory in the Kudo DebugConsole and move into the path D:\home\Python34, then you can directly call python which be the new installed one.

Hope it helps.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43