I am trying to run a python script using WebJob in Azure. But I am getting module is not found. When I tried to run the pip command it says Access denied
Also I tried to change the folder permission using
os.chmod
[11/11/2016 18:17:35 > e1c140: ERR ] chmod: changing permissions of 'D:\Python27\Lib\site-packages/setuptools/....pyc': Permission denied
[11/11/2016 18:17:38 > e1c140: INFO] error: could not create 'D:\Python27\Lib\site-packages\mpns': Access is denied
--user
def install(pack):
pip.main(['install', "--user", pack])
(beautifulsoup, mechanize , python-mpns)
python setup.py install
So this is what worked for me (for Azure Functions but they are similar to WebJob and they even use the same SDK). I've copied wheel package of the module in question to the same github where the Function code was and added following code to the Function initialization:
import os,pip,sys,time try: import pyodbc except: package = 'pyodbc-3.0.10-cp27-none-win32.whl' pip.main(['install', '--user', package]) raise ImportError('Restarting')
You could obviously copy wheel package any other way, I just found this way convenient enough.