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?

3
  • why dont you use requirements.txt? Commented Nov 2, 2017 at 6:55
  • Exhausted every google search recommendation. So, certainly, I have put the string into requirements.txt. The module 'requests' is in the remote system, Azure just seems to ignore it. Commented Nov 2, 2017 at 19:13
  • in this case i would ask if you are targeting the right version of python, you are probably targeting 3 and using 2 or vice versa Commented Nov 2, 2017 at 19:19

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.