I am trying to host my app on IBM bluemix. In my app, I have used flask and I am trying to Connect to Azure SQL Server database. So for that, I am using Pyodbc.
So in requirement.txt
file I have given
pip install pyodbc
and
pip install flask
.
These things are getting installed on my local machine and the app is running fine. I am getting the result from the database .
But when I am trying to deploy my application on IBM bluemix,
while pushing the files on the server it is giving me an error.
I have attached the error screenshot below.
The content of requirement.txt is here
unixodbc-dev
pyodbc==3.1.1
Flask==0.12.2
One solution is to use miniconda to install your dependencies instead of pip. Using miniconda with the buildpack is documented here.
See here for more information on using miniconda to install pyodbc.
The error message error: command 'gcc' failed with exit status 1
makes it seem like perhaps you need to install the gcc C/C++ compiler on that machine.
The pyodbc docs say:
Windows
On Windows, you will need the appropriate Microsoft Visual C++ compiler. To build Python 2.4 or 2.5 versions, you will need the Visual Studio 2003 .NET compiler. Unfortunately there is no free version of this.
For Python 2.6 and above, you can use the free Visual C++ 2008 Express compiler. (Do not use the 2010 version! You need to use the version that your Python distribution was built with.)
You can create a Windows installer using: python setup.py bdist_wininst
Other
To build on other operating systems, use the gcc compiler.
On Linux, pyodbc is typically built using the unixODBC headers, so you will need unixODBC and its headers installed. On a RedHat/CentOS/Fedora box, this means you would need to install unixODBC-devel:
yum install unixODBC-devel
Related: Unable to install pyodbc on Linux