Using PIP in Azure WebApp

I am new to Azure and I am trying to start Django WebApp. I uploaded files using FTP, but Azure does not start my requirements.txt .

So I searched a bit and found out that you can install requirements.txt with pip.

Back in Azure, PIP does not seem to work. Neither in the console, nor in KUDU CMD, nor in KUDU powershell. Python really works.
When I try to install PIP through Python, it first says that the old version is already installed. When Python tries to update PIP, it does not have access to the folder that needs to be edited.

I was wondering how I can use PIP in azure.
(If you know a separate way to install requirements.txt , tell me, because that's how I came to this question.)

+6
source share
5 answers

Based on my understanding, I think you want to create a virtual environment for Python and do some package installation using requirement.txt for Django WebApp and got some problems.

For Django on Azure WebApp, I recommend creating a preinstalled Django from WebApp from the gallery on the old Azure portal.

However, according to the Azure whitepaper, you also cannot install some packages using pip, see the examples below.

Some packages may not install with pip when running on Azure. It may just be that the package is not available in the Python Package Index. A compiler may be required (the compiler is not available on the computer running the web application in the Azure App Service).

But you can refer to the official troubleshooting document to solve this problem, see https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-django-app/ #troubleshooting --- package-installation .

+1
source

Have you tried updating pip with easy_install? The following worked for me in the Azure kudu console:

python -m easy_install --upgrade --user pip

+1
source

You cannot update the ping of your Django webapp because you will not have access to system files.

Instead, you can update the pip of your virtual user, which you can do by adding a line to the deploy.cmd file before installing the requirements.txt command.

env\scripts\python -m pip install --upgrade pip

Remember to update pip with pip (env / scripts / pip), otherwise it will remove the global pip.

+1
source

I suggest you use Visual Studio 2013/2015 to manage your Django project. You can get the free Visual Studio 2015 community and install PTVS 2.2 for it.

Using PTVS, you can create a virtual environment using requirement.txt and deploy your project using Visual Studio. Sometimes you simply cannot install some Python packages due to a compiler problem (some packages require a lower version of the compiler). Therefore, it is better to compile them on your computer and deploy the virtual environment to the Azure Website.

More about Django and database on SQL Azure with Python Tools 2.2 for Visual Studio

0
source

You can use pip by changing the console path to Python27 / Scripts

 cd D:\Python27\Scripts 
0
source

All Articles