I am trying to run a Python job using a VM on Azure Batch, utilizing the Python package Pyodbc. However I am unable to install it correctly (obviously) as run into ModuleNotFoundError: No module named 'pyodbc'
. I used the following command (start task) to install the ODBC driver on my VM (Ubuntu) and installation works fine:
/bin/bash -c 'sudo -H apt-get -y update &&
sudo -H dpkg --configure -a &&
sudo -H apt-get install -y python3-pip &&
sudo -H pip3 install --upgrade pip &&
sudo -H su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo -H apt-get update
sudo -H ACCEPT_EULA=Y apt-get install -y msodbcsql17
sudo -H apt-get install -y unixodbc-dev &&
sudo -H pip3 install pandas &&
sudo -H pip3 -H install egg &&
sudo -H pip3 -H install azure-storage-common &&
sudo -H pip3 install --upgrade pyodbc &&
sudo -H pip3 install azure-storage-blob'
The wierd part is that I can run import pandas
and the other packages without any problem. Can someone help me out?
guide for installing ODBC: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017