Open jaromey opened 5 years ago
Hi @jaromey, I have tested this example with the following libraries in the requirements.txt:
Django==2.1.2 psycopg2==2.8.4 pytz==2018.5 whitenoise==4.1
And I was able to deploy it to Azure Web App Linux with Python 3.7, as this image depends in Oryx image, the dependency (libpq-dev) for installing psycopg2 is listed there:
https://github.com/microsoft/Oryx/blob/master/images/runtime/python/install-dependencies.sh#L16
Thanks for your response @edisga. I was never able to got psycopg2 to install in Azure Web App for Linux with Python 3.7. The workaround that I did was to use wheels to pre-compile psycopg. So in our build process we had the following:
pip install wheel
pip wheel -r vendor-requirements.txt -w wheelhouse
Contents of vendor-requirements.txt:
psycopg2==2.8.3
Then in our regular requirements.txt file we had the following:
--find-links wheelhouse
Django==2.2.5
psycopg2==2.8.3
pytz==2019.2
whitenoise==4.1.4
...
However, you said that it worked for you so I am wondering if I am missing something. Is there some configuration that I needed to do?
I'm also experiencing the same issue. I just fired up a fresh B1 instance and can cannot get psycopg2 installed, only psycopg2-binary. When trying to install psycopg2, it says
unable to execute 'gcc': No such file or directory
Removed the reference so that only Django is in requirements.txt. Thanks.
Reopening because of changes to requirements.txt, which leaves this issue unresolved.
We are having the same issue while installing pyscopg2
library. Would love get a solution for this. Dont want to run pyscopg2-binary for my production environment.
We're working to get gcc installed in the host container, which would allow psycopg2 to install automatically as a django dependency. Thanks for your feedback, as it should help prioritize that update.
This repo is referenced in the Microsoft Azure doc, "Build a Python (Django) web app with PostgreSQL in Azure App Service". However, the requirements.txt file in this repo uses pyscopg2-binary which is not the recommended library for production. There is nothing in the doc that suggests that the pyscopg2-binary libary should be avoided for production which can give developers the impression that this is the standard library that should be used.
The problem is that pyscopg2 does not install on Azure App Service for Linux because the container doesn't have the dependency to build pyscopg2. So there is no choice but to use pyscopg2-binary. If there is a walk-through on the Azure docs to deploy a Django app with Postgres then the container that is used for Azure app service should be able to build psycopg2 which is the recommendation for production. I think it is very misleading otherwise.