0

I was following this answer to be able to connect to an external SQL server using the Google Console Cloud Run. (https://stackoverflow.com/a/46446438/13342846)

However, I am receiving the following error when deploying

Package unixodbc-bin is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
[91mE: Package 'unixodbc-bin' has no installation candidate
[0m
unable to stream build output: The command '/bin/sh -c apt-get install unixodbc-bin -y' returned a non-zero code: 100
Failed to build the app. Error: unable to stream build output: The command '/bin/sh -c apt-get install unixodbc-bin -y' returned a non-zero code: 100

Docker file:

# Python image to use.
FROM python:3.7

# Set the working directory to /app
WORKDIR /app

# copy the requirements file used for dependencies
COPY requirements.txt .

ADD odbcinst.ini /etc/odbcinst.ini
RUN apt-get update 
RUN apt-get install -y tdsodbc unixodbc-dev 
RUN apt-get install unixodbc-bin -y 
RUN apt-get clean -y 

#....etc

I also created the odbcinst.ini file as described here: https://stackoverflow.com/a/55282188/13342846

The Python image it is using is 3.7

Any help would be appreciated!

bigbatmoegan
  • 1
  • 1
  • 3
  • Why do you think you need `unixodbc-bin`? That's an odd choice for a headless Docker container since _This package contains three graphical applications for use with unixODBC, the Open DataBase Connectivity suite._ [Ref](https://packages.debian.org/buster/unixodbc-bin) – AlwaysLearning Dec 28 '21 at 23:56
  • If all you're trying to do is get `pyodbc` up and running then what you need to do is: 1) identify the distro and version behind `python:3.7` so that you can 2) follow the correct instruction to [Install the Microsoft ODBC driver for SQL Server (Linux)](https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server), then finally 3) [Configure development environment for pyodbc Python development](https://learn.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development). – AlwaysLearning Dec 29 '21 at 00:03
  • The following user was able to answer this question about the problem, [See Here](https://stackoverflow.com/a/51560685/13342846), and lists unixodbc-bin as a dependency of PyODBC, and since this a Google Console Cloud Run, there are no ODBC drivers and just using pip to import won't work at all – bigbatmoegan Dec 29 '21 at 14:16

1 Answers1

3

I ran into the same problem. Replacing unixodbc-bin with unixodbc solved the problem for me.

reejad
  • 76
  • 3