title: Installing SQL Server ODBC library throwing error in Azure databricks runtime 8.3
body: <p>I am trying to install ODBC library for SQL Server 2017 to be used to connect to SQL Server using pyodbc Python package. I got this piece of code from StackOverflow only. I am getting error while installing.</p>
  <p>This is the script I am running:</p>
  <pre><code>%sh
  curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
  curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list &gt; /etc/apt/sources.list.d/mssql-release.list
  sudo apt-get update
  sudo ACCEPT_EULA=Y apt-get -q -y install msodbcsql17
  </code></pre>
  <p>And I get this error:</p>
  <pre><code>% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: apt-key output should not be parsed (stdout is not a terminal)
  E: This command can only be used by root.
  
  100   983  100   983    0     0   3640      0 --:--:-- --:--:-- --:--:--  3640
  **(23) Failed writing body**
  /bin/bash: line 1: /etc/apt/sources.list.d/mssql-release.list: Permission denied
  sudo: no tty present and no askpass program specified
  sudo: no tty present and no askpass program specified
  </code></pre>
  <p>I tried another script as below.</p>
  <pre><code>%sh
  curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
  curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list &gt; /etc/apt/sources.list.d/mssql-release.list 
  apt-get update
  ACCEPT_EULA=Y apt-get install msodbcsql17
  apt-get -y install unixodbc-dev
  sudo apt-get install python3-pip -y
  pip3 install --upgrade pyodbc
  </code></pre>
  <p>This one also failing as below.</p>
  <pre><code> % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: apt-key output should not be parsed (stdout is not a terminal)
  E: This command can only be used by root.
  
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  100   983  100   983    0     0   1790      0 --:--:-- --:--:-- --:--:--  1787
  (23) Failed writing body
  /bin/bash: line 1: /etc/apt/sources.list.d/mssql-release.list: Permission denied
  Reading package lists...
  E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
  E: Unable to lock directory /var/lib/apt/lists/
  **E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
  E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
  E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
  E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?**
  sudo: no tty present and no askpass program specified
  Defaulting to user installation because normal site-packages is not writeable
  Collecting pyodbc
    Downloading pyodbc-4.0.32.tar.gz (280 kB)
  Building wheels for collected packages: pyodbc
    Building wheel for pyodbc (setup.py): started
    Building wheel for pyodbc (setup.py): finished with status 'done'
    Created wheel for pyodbc: filename=pyodbc-4.0.32-cp38-cp38-linux_x86_64.whl size=317312 sha256=baca7539ec5fb88f940fb9ba944609c211a1c84d73d02f659c9deaa0f463b700
    Stored in directory: /home/spark-fcbd5404-644a-45c3-a4b1-9a/.cache/pip/wheels/68/de/de/65a129482924e96fb701c51488b907953acf25fe623bb177b3
  Successfully built pyodbc
  Installing collected packages: pyodbc
  Successfully installed pyodbc-4.0.32
  WARNING: You are using pip version 20.2.4; however, version 21.2.4 is available.
  You should consider upgrading via the '/databricks/python3/bin/python -m pip install --upgrade pip' command.
  </code></pre>
  <p>Not sure how to install SQL Server ODBC and pyodbc properly. Please help.</p>