0

J'ai essayé d'installer certains paquets python dans mon application Web Django sur Azure. J'essaie d'installer les paquets en utilisant les fichiers wheel requirements.txt et pips, comme cela est indiqué ici https://blogs.msdn.microsoft.com/azureossds/2015/06/29/install-native-python-modules-on-azure-web-apps-api-apps/Application Web Azure avec installations python et pignons

Le problème est que le pip ne semble pas localiser le dossier de la timonerie. Le dossier wheelhouse se trouve à la racine du répertoire de mon application, où je garde également le fichier requirements.txt, manage.py, readme.md et les fichiers web.config.

Voici ce que mon fichier requirements.txt ressemble:

--find-links wheelhouse 
django<2 
pyodbc==4.0.17 
django-pyodbc-azure==1.11.0 

Here're les fichiers dans le dossier timonerie:

~/myapp/wheelhouse/django_pyodbc_azure-1.11.0.0-py2.py3-none-any.whl 
~/myapp/wheelhouse/Django-1.11.4-py2.py3-none-any.whl 
~/myapp/wheelhouse/pyodbc-4.0.17-cp27-cp27m-win_amd64.whl 
~/myapp/wheelhouse/pyodbc-4.0.17-cp27-cp27m-win32.whl 

J'ai téléchargé les fichiers du pyodbc d'ici: http://www.lfd.uci.edu/~gohlke/pythonlibs/

Le fichier django_pyodbc_azure-1.11.0.0-py2.py3-none-any.whl a été créé en utilisant un ordinateur portable Windows avec le compilateur windows C++ pour python installé (https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266)

Lorsque vous appuyez sur les commits au serveur je encore

Counting objects: 7, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (7/7), done. 
Writing objects: 100% (7/7), 730 bytes | 0 bytes/s, done. 
Total 7 (delta 3), reused 0 (delta 0) 
remote: Updating branch 'master'. 
remote: ...................................................................... 
remote: Updating submodules. 
remote: Preparing deployment for commit id '7feb3f4dde'. 
remote: Generating deployment script. 
remote: Running deployment command... 
remote: Handling python deployment. 
remote: Detected requirements.txt. You can skip Python specific steps with a .skipPythonDeployment file. 
remote: Detecting Python runtime from site configuration 
remote: Detected python-2.7 
remote: Deleting incompatible virtual environment. 
remote: ..................................................................................... 
remote: Creating python-2.7 virtual environment. 
remote: ... 
remote: New python executable in env\Scripts\python.exe 
remote: ........................................ 
remote: Installing setuptools, pip...done. 
remote: Pip install requirements. 
remote: . 
remote: Downloading/unpacking django<2 (from -r requirements.txt (line 2)) 
remote: ......................... 
remote: Downloading/unpacking pyodbc==4.0.17 (from -r requirements.txt (line 3)) 
remote: Running setup.py (path:D:\home\site\wwwroot\env\build\pyodbc\setup.py) egg_info for package pyodbc 
remote:  
remote: Downloading/unpacking django-pyodbc-azure==1.11.0 (from -r requirements.txt (line 4)) 
remote: Downloading/unpacking pytz (from django<2->-r requirements.txt (line 2)) 
remote: Installing collected packages: django, pyodbc, django-pyodbc-azure, pytz 
remote: ............................................................................................................................. 
remote: Running setup.py install for pyodbc 
remote:  building 'pyodbc' extension 
remote:  error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27 
remote:  Complete output from command D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools, tokenize;__file__='D:\\home\\site\\wwwroot\\env\\build\\pyodbc\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record d:\local\temp\pip-hgg_tz-record\install-record.txt --single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7: 
remote:  running install 
remote: 
remote: running build 
remote: 
remote: running build_ext 
remote: 
remote: building 'pyodbc' extension 
remote: 
remote: error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27 
remote: 
remote: ---------------------------------------- 
remote: Cleaning up... 
remote: .................................................................................................................................. 
remote: Command D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools, tokenize;__file__='D:\\home\\site\\wwwroot\\env\\build\\pyodbc\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record d:\local\temp\pip-hgg_tz-record\install-record.txt --single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7 failed with error code 1 in D:\home\site\wwwroot\env\build\pyodbc 
remote: Storing debug log for failure in D:\home\pip\pip.log 
remote: An error has occurred during web site deployment. 
remote: 
remote: Error - Changes committed to remote repository but deployment to website failed. 

Je suis vraiment confus quant à ce que je fais mal ici. Des idées? Une supposition serait que le dossier wheelhouse devrait être déplacé vers un sous-répertoire? J'ai essayé de le déplacer vers le dossier env de l'application sous les scripts, mais cela n'a pas fonctionné non plus.

Merci pour votre temps.

EDIT

J'ai donc essayé d'exécuter les scripts directement à partir de ma console Kudu et voici l'erreur que je reçois:

D:\home\site\wwwroot\env\Scripts\pip run on 08/25/17 15:51:48 
pyodbc-4.0.17-cp27-cp27m-win32.whl is not a supported wheel on this platform. 
Exception information: 
Traceback (most recent call last): 
    File "D:\home\site\wwwroot\env\lib\site-packages\pip\basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "D:\home\site\wwwroot\env\lib\site-packages\pip\commands\install.py", line 257, in run 
    InstallRequirement.from_line(name, None)) 
    File "D:\home\site\wwwroot\env\lib\site-packages\pip\req.py", line 167, in from_line 
    raise UnsupportedWheel("%s is not a supported wheel on this platform." % wheel.filename) 
UnsupportedWheel: pyodbc-4.0.17-cp27-cp27m-win32.whl is not a supported wheel on this platform. 

Répondre

1

L'approche recommandée est de mettre à jour Python sur votre WebApp en utilisant une extension: https://docs.microsoft.com/visualstudio/python/managing-python-on-azure-app-service

Depuis, la version par défaut de Python sur WebApp est terriblement ancienne (et non sécurisée). Vous obtiendrez une nouvelle version de pip, capable de gérer tous les fichiers de roues (actuellement ce n'est pas comme vous l'avez vu ...). Notez que les extensions Python sont compilées par Microsoft, elles sont officielles.

+0

Ah, merci pour ça! Le problème était l'ancienne version de pip, et cela semble être une solution. – P4nd4b0b3r1n0