1

I came across with a runtime error from my Azure function:

Result: Failure Exception: Exception: pdftotext is not installed. It is part of xpdf or poppler-utils software suite. 
Installation on Linux: wget --no-check-certificate https://dl.xpdfreader.com/xpdf-tools-linux-4.02.tar.gz && tar -xvf xpdf-tools-linux-4.02.tar.gz && sudo cp xpdf-tools-linux-4.02/bin64/pdftotext /usr/local/bin 
Installation on MacOS: brew install xpdf 
You can find more details here: https://www.xpdfreader.com 
Stack: File "/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker/dispatcher.py", line 357, in _handle__invocation_request self.__run_sync_func, invocation_id, fi.func, args) File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) 
File "/azure-functions-host/workers/python/3.6/LINUX/X64/azure_functions_worker/dispatcher.py", line 542, in __run_sync_func return func(**params) File "/home/site/wwwroot/testFunction/__init__.py", line 45, in main searchResult = bootLoader.run(filePath, query) 
File "/home/site/wwwroot/testFunction/bootLoader.py", line 44, in run doc = docPrepare(filePath) File "/home/site/wwwroot/testFunction/bootLoader.py", line 19, in docPrepare converter = PDFToTextConverter(remove_numeric_tables=True, valid_languages=["en"]) File "/home/site/wwwroot/testFunction/haystack/file_converter/pdf.py", line 38, in __init__ """
Error

The function runs successfully on my machine since I have installed the xpdf locally. My questions is how to install pdftotext to the running environment (linux) of my function?

ENV

python 3.6

MAC OSX mojave

Deployed via vs code azure function extension

UPDATE

I visited the https://{FunctionAppName}.scm.azurewebsites.net/.enter image description here

chaos
  • 338
  • 4
  • 16

1 Answers1

1

You can use the Kudu Console from your function app and then you need to navigate to the www root folder and do the pip install

I have described in the last section of this post

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • Thanks to your suggestion. I tried to find the kudu console and saw this [article](https://stackoverflow.com/questions/56035616/how-do-i-open-kudu-console-in-azure-functions-consumption-plan). It seems kudu console is not supported for linux consumption plan. Correct my if I am wrong. Does it mean I have to upgrade my function app into another plan? – chaos Jan 31 '21 at 12:11
  • I updated the OP with the content from the site `https://{FunctionAppName}.scm.azurewebsites.net/`. Please have a look. – chaos Jan 31 '21 at 12:20
  • https://stackoverflow.com/questions/43970307/azure-functions-installing-python-modules-and-extensions-on-consumption-plan – Sajeetharan Feb 01 '21 at 08:26
  • I saw that post and did follow the instructions, but I cannot find the kudu console for my function. I then found [this post](https://stackoverflow.com/questions/56035616/how-do-i-open-kudu-console-in-azure-functions-consumption-plan) which indicates that kudu is not available for function in consumption plan. – chaos Feb 01 '21 at 10:18