0
votes

I have a Python application on my Windows laptop and a SQL database resource set up in Azure Cloud. I've added a pyodbc module to this application, and installed a relevant driver. I am able to get my Python application working with my SQL database in Azure. This works great.

I've tried uploading my Python application to an App Service resource in Azure Cloud, but I've run into a problem. I see the following error in an error log:

from app import SQLServerComm 2020-11-30T10:44:16.178080873Z File "/home/site/wwwroot/app/SQLServerComm.py", line 1, in 2020-11-30T10:44:16.178084673Z import pyodbc 2020-11-30T10:44:16.178088073Z ModuleNotFoundError: No module named 'pyodbc' 2020-11-30T10:44:16.190749473Z

I realize that I have to install the Python module pyodbc in the Azure environment somehow (for instance, to run "pip install pyodbc" and install a driver somewhere). I'm probably missing something obvious in the documentation, but how may I most simply do this?

1
How's going? Has your issue been solved ?Stanley Gong
Yes, it has. I'm still new to Stack Exchange and so my green checkmark doesn't show. My code works great now, thanks for the help!Mark Sulkowski
Glad to know that my suggestion is helpful! Accepting answers is available for all users, if my answer helped you, click on the check mark beside the answer to toggle it from greyed out to filled in to accept it , it is important for answers. If you need more help in the future, just let me know : )Stanley Gong

1 Answers

0
votes

Please try to run pip freeze >> requirements.txt at the root of your project to record your environment's current package list and redeploy your project.

After you run this command, the required modules will be listed: enter image description here

When you redeploy your project, the App Service deployment engine automatically activates a virtual environment and runs pip install -r requirements.txt for you to install all modules you need.

Please let me know if you need more assistance.