I have a problem with deploy my Django project to MS Azure.I working on Linux env. I made files runtime.txt, requirements.txt and push it to Azure, but I have trouble when the service tried to install mysqlclient. Azure tried install this lib from source code, not wheel file. After this situation I have added .whl file to my project in folder 'wheelhouse' and changed requirement.txt, next I pushed it and took the same error: error: Unable to find vcvarsall.bat . Here log file from Azure, structure my project, requirements.txt
|project/
|--app/
|--wheelhouse/
|----mysqlclient-1.3.10-cp35.whl
reuirements.txt
--find-links wheelhouse
mysqlclient==1.3.10
Django==1.10.4
Log from azure
Command: "D:\\home\\site\\deployments\\tools\\deploy.cmd" Handling python deployment. Detected requirements.txt. You can skip Python specific steps with a .skipPythonDeployment file. Detecting Python runtime from runtime.txt Detected python-3.4 Found compatible virtual environment. Pip install requirements. Downloading/unpacking mysqlclient==1.3.10 (from -r requirements.txt (line 2)) Running setup.py (path:D:\\home\\site\\wwwroot\\env\\build\\mysqlclient\\setup.py) egg_info for package mysqlclient
warning: no files found matching 'GPL-2.0' Requirement already satisfied (use --upgrade to upgrade): Django==1.10.4 in
d:\\home\\site\\wwwroot\\env\\lib\\site-packages (from -r requirements.txt (line 3)) Installing collected packages: mysqlclient Running setup.py install for mysqlclient building '_mysql' extension error: Unable to find vcvarsall.bat Complete output from command D:\\home\\site\\wwwroot\\env\\Scripts\\python.exe -c "import setuptools, tokenize; file ='D:\\home\\site\\wwwroot\\env\\build\\mysqlclient\\setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\\r\\n', '\\n'), file , 'exec'))" install --record D:\\local\\Temp\\pip-8m_f_kxa-record\\install-record.txt --single-version-externally-managed --compile --install-headers D:\\home\\site\\wwwroot\\env\\include\\site\\python3.4: running install
running build
running build_py
creating build
creating build\\lib.win32-3.4
copying _mysql_exceptions.py -> build\\lib.win32-3.4
creating build\\lib.win32-3.4\\MySQLdb
copying MySQLdb__init__.py -> build\\lib.win32-3.4\\MySQLdb
copying MySQLdb\\compat.py -> build\\lib.win32-3.4\\MySQLdb
copying MySQLdb\\connections.py -> build\\lib.win32-3.4\\MySQLdb
copying MySQLdb\\converters.py -> build\\lib.win32-3.4\\MySQLdb
copying MySQLdb\\cursors.py -> build\\lib.win32-3.4\\MySQLdb
copying MySQLdb\\release.py -> build\\lib.win32-3.4\\MySQLdb
copying MySQLdb\\times.py -> build\\lib.win32-3.4\\MySQLdb
creating build\\lib.win32-3.4\\MySQLdb\\constants
copying MySQLdb\\constants__init__.py -> build\\lib.win32-3.4\\MySQLdb\\constants
copying MySQLdb\\constants\\CLIENT.py -> build\\lib.win32-3.4\\MySQLdb\\constants
copying MySQLdb\\constants\\CR.py -> build\\lib.win32-3.4\\MySQLdb\\constants
copying MySQLdb\\constants\\ER.py -> build\\lib.win32-3.4\\MySQLdb\\constants
copying MySQLdb\\constants\\FIELD_TYPE.py -> build\\lib.win32-3.4\\MySQLdb\\constants
copying MySQLdb\\constants\\FLAG.py -> build\\lib.win32-3.4\\MySQLdb\\constants
copying MySQLdb\\constants\\REFRESH.py -> build\\lib.win32-3.4\\MySQLdb\\constants
running build_ext
building '_mysql' extension
error: Unable to find vcvarsall.bat
---------------------------------------- Cleaning up... Command D:\\home\\site\\wwwroot\\env\\Scripts\\python.exe -c "import setuptools, tokenize; file ='D:\\home\\site\\wwwroot\\env\\build\\mysqlclient\\setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\\r\\n', '\\n'), file , 'exec'))" install --record D:\\local\\Temp\\pip-8m_f_kxa-record\\install-record.txt --single-version-externally-managed --compile --install-headers D:\\home\\site\\wwwroot\\env\\include\\site\\python3.4 failed with error code 1 in D:\\home\\site\\wwwroot\\env\\build\\mysqlclient Storing debug log for failure in D:\\home\\pip\\pip.log An error has occurred during web site deployment. \\r\\nD:\\Program Files (x86)\\SiteExtensions\\Kudu\\61.60316.2745\\bin\\Scripts\\starter.cmd "D:\\home\\site\\deployments\\tools\\deploy.cmd"
Your problem is caused by an old pip on WebApp by default. You have two solutions:
Prefered: Do not use default Python on WebApps (I guess it's a WebApp?), use a Python extension. They are up to date with latest pip and you can use Python 3.6.1:
https://blogs.msdn.microsoft.com/pythonengineering/2016/08/04/upgrading-python-on-azure-app-service/
Avoid this solution unless you have a specific reason to do so: Create a virtualenv with the default Python and update pip first (from a Kudu console it's simple "pip install -U pip"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.