0

In Azure, using Python with the Flask and pandas modules to create a RESTful webservice. Azure doesn't appear able to find the requests_file module.

Launching the web page keeps returning error: No module named requests_file

I have installed "requests" and "requests_file" manually using the Kudu CLI https://"yoursitename".scm.azurewebsites.net/DebugConsole.

They both appear to be there. What am I missing or is there a bug in Azure?

Justin Malinchak
  • 509
  • 1
  • 6
  • 11

1 Answers1

1

You could configure your requirements.txt file in your flask project.

Put the list of your python modules in the requirements.txt requests==2.18.4

Install wheel module using below command

python.exe -m pip install wheel

Use Below Command to create wheel files inside wheelhouse folder in Local environment

python.exe -m pip wheel -r requirements.txt -w wheelhouse

Then upload your project to your azure web app.

You could use code as below to test requests module

import requests

r= requests.get("https://www.bing.com")
print r.status_code

More details , please refer to this blog and this thread: Publishing MVC app that uses python script

Hope it helps you.

Jay Gong
  • 23,163
  • 2
  • 27
  • 32
  • To fix this, you have ensure the web.config file points to the correct "site-packages" directory. The default value is typically incorrect, especially if you add a new python version using Site Extension. – Justin Malinchak Nov 07 '17 at 15:25