Skip to content

Python 3.14 Ubuntu Noble runtime image missing msodbcsql18 — SQL Server connections fail on App Service #2920

Closed

Description

@gg-aersale

Summary

The Python 3.14 Ubuntu Noble runtime images published to MCR ship the
unixODBC driver manager (libodbc2) but not the Microsoft SQL Server
ODBC drivers (msodbcsql17 / msodbcsql18). This breaks any App Service
Python 3.14 deployment that uses pyodbc / mssql-django / pymssql,
which works on 3.13 and earlier.

Reproduction

Pulling the latest published 3.14 tag and inspecting it:

docker run --rm mcr.microsoft.com/oryx/python:3.14-ubuntu-noble-20260217.1 \
  bash -c "cat /etc/odbcinst.ini 2>&1; ls /opt/microsoft 2>/dev/null; dpkg -l | grep -E 'odbc|mssql'"                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                    
Output:                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                    
cat: /etc/odbcinst.ini: No such file or directory                                                                                                                                                                                                                                                                   
ii  libodbc2:amd64    2.3.12-1ubuntu0.24.04.1    amd64    ODBC Driver Manager library for Unix
                                                                                                                                                                                                                                                                                                                    
No /etc/odbcinst.ini, no /opt/microsoft/, no msodbcsql* packages.                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                                                    
For comparison, on the 3.13 image both msodbcsql17 and msodbcsql18 are                                                                                                                                                                                                                                              
installed and /etc/odbcinst.ini registers them.
                                                                                                                                                                                                                                                                                                                    
Impact          
                                                                                                                                                                                                                                                                                                                    
On Azure App Service Linux with the Python 3.14 stack, any app using                                                                                                                                                                                                                                                
SQL Server fails at startup or first DB call with:
                                                                                                                                                                                                                                                                                                                    
('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 18 for SQL Server' : file not found (0) (SQLDriverConnect)")
                                                                                                                                                                                                                                                                                                                    
Same requirements.txt and code work on the Python 3.13 stack.                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                    
Likely cause                                                                                                                                                                                                                                                                                                        
                
PR #2635 (commit ccd7b21) onboarded the 3.14 Noble image. One of the                                                                                                                                                                                                                                                
bullets reads: "install odbc2 package only for ubuntu based image" —
which adds libodbc2 (the manager) but does not install                                                                                                                                                                                                                                                              
msodbcsql17/msodbcsql18 (the actual drivers).
                                                                                                                                                                                                                                                                                                                    
images/runtime/python/install-dependencies.sh on main does install                                                                                                                                                                                                                                                  
both drivers and writes /etc/unixODBC/odbcinst.ini, but that path does                                                                                                                                                                                                                                              
not appear to be executed for the Noble flavor of the 3.14 runtime                                                                                                                                                                                                                                                  
image — the published artifact does not contain those packages.                                                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                                                    
Suggested fix                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                    
Ensure the Noble runtime path for Python (and any other Noble-based                                                                                                                                                                                                                                                 
images that previously shipped with SQL Server connectivity on Bookworm)
runs the same MS package install steps as install-dependencies.sh:                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                    
- Add the Microsoft packages.microsoft.com apt source for Ubuntu Noble                                                                                                                                                                                                                                              
(signed-by GPG, replacing deprecated apt-key).                                                                                                                                                                                                                                                                      
- ACCEPT_EULA=Y apt-get install -y msodbcsql17 msodbcsql18 mssql-tools18 unixodbc-dev.                                                                                                                                                                                                                              
- Verify /etc/odbcinst.ini lists both drivers after build.                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                                                    
Verification                                                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                                                                    
After the fix, the reproduction command above should show both drivers                                                                                                                                                                                                                                              
in dpkg -l, and:
                                                                                                                                                                                                                                                                                                                    
python -c "import pyodbc; print(pyodbc.drivers())"
# ['ODBC Driver 18 for SQL Server', 'ODBC Driver 17 for SQL Server']                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                    
Environment                                                                                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                                                    
- Image checked: mcr.microsoft.com/oryx/python:3.14-ubuntu-noble-20260217.1                                                                                                                                                                                                                                         
- Also confirmed on the version currently rolled to App Service Python
3.14 stack (Linux).                                                                                                                                                                                                                                                                                                 
- Working baseline: mcr.microsoft.com/oryx/python:3.13-* (both drivers                                                                                                                                                                                                                                              
present).   

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions