"Unable to locate package msodbcsql17" when installing on python:3.13 image in Docker

Efraín Cárdenas 5 Reputation points
2025-08-14T14:35:29.52+00:00

Until a pair of days ago, I had a Dockerfile with these instructions, that allowed me to install msodbcsql17, to be able to connect my project to a MSSQL Database, but for some reason, since 2 days ago it started failing, and we didn't change anything.

FROM python:3.13 AS builder
...

RUN apt-get update && apt-get install -y \unixodbc \
	unixodbc-dev \
	odbcinst \
	odbcinst1debian2 \
	libodbc1 \
	curl \
	gnupg \
	&& rm -rf /var/lib/apt/lists/*

RUN curl -sSL -O https://packages.microsoft.com/config/debian/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2 | cut -d '.' -f 1)/packages-microsoft-prod.deb && \
	dpkg -i packages-microsoft-prod.deb && \
	rm packages-microsoft-prod.deb && \
	apt-get update && \
	ACCEPT_EULA=Y apt-get install -y msodbcsql17 && \
	echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

...

I know that odbcinst1debian2 and libodbc1 got deprecated, so I removed from the packages when I was installing, but I'm not sure if this has something to do, so that's why I left it here, as a reference. When trying to build my image now, it stops with the error E: Unable to locate package msodbcsql17 . From the logs, I see that it tried to get list of packages from the MS repository, since I see these 2 lines

Get:1 https://packages.microsoft.com/debian/13/prod trixie InRelease [3952 B]
Get:3 https://packages.microsoft.com/debian/13/prod trixie/main all Packages [342 B]


But when I tried to execute apt-cache search msodbc in the instance, it didn't output anything, as if the packages does not exist. Has something changed in how to install the libraries on Debian? I see that in the docs they are still the same. Or, Has the packaged changed its name?

SQL Server | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Efraín Cárdenas 5 Reputation points
    2025-08-15T01:47:06.9266667+00:00

    After a lot of time debugging this, managed to find the problem. Looks like python:3.13 changed from Debian 12 to 13, and that caused the issue, since 13 is still not supported. Just changed to python:3.13-bookworm, and works again.

    Be careful with the tags of your Docker images.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.