Error installing Python 2 packages in Azure Automation - python

I'm trying to install Instagram-API-python in Azure Automation to automatize data extraction from this API with a Python script.
When I try to install it uploading the .tar.gz file or by the "Import Python 2 packages from pypi" script, azure automation shows me the following message:
Orchestrator.Activities.PythonPackageExtractException: Error while
extractinig Python package: Error converting tar.gz file to wheel
file. Unexpected number of wheel files were created. at
Orchestrator.Activities.SetModuleActivity.ExecuteInternal(CodeActivityContext
context, Byte[] moduleContent, String moduleName, ModuleLanguage
moduleLanguage, Guid moduleVersionId, String modulePath) at
Orchestrator.Activities.SetModuleActivity.Execute(CodeActivityContext
context) at
System.Activities.CodeActivity.InternalExecute(ActivityInstance
instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at
System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
executor, BookmarkManager bookmarkManager, Location resultLocation)
Any idea why it is showing me this message?

I am assuming that it is failing as it is not able to resolve all the dependencies , try using the Manual download option.
Azure automation doesn't resolve dependencies for python packages during the import process. There are two ways to import a package with all its dependencies. Only one of the following steps needs to be used to import the packages into your Automation Account.
Manual Download
On a Windows 64-bit machine with python2.7 and pip installed, run the following command to download a package and all its dependencies:
C:\Python27\Scripts\pip2.7.exe download -d <output dir> <package name>
Once the packages are downloaded, you can import them into your automation account.
RunBook
Import the python runbook Import Python 2 packages from pypi into Azure Automation account from the gallery into your Automation Account. Make sure the Run Settings are set to Azure and start the runbook with the parameters. The runbook requires a Run As Account for the Automation Account to work. For each parameter make sure you start it with the switch as seen in the following list and image:
s
g
a
m
The runbook allows you to specify what package to download, for example, Azure (the fourth parameter) will download all Azure modules and all its dependencies, which is about 105.
Once the runbook has completed you can check the Python 2 packages page under Shared Resources in your Automation Account to verify that they package was imported correctly.
Hope it helps.

The Manual Download worked for me.

Related

missing_dependencies error using Pandas in Azure Web Job

I need to run some long running job via Azure Web Job in Python.
I am facing below error trying to import pandas.
File "D:\local\Temp\jobs\triggered\demo2\eveazbwc.iyd\pandas_init_.py", line 13
missing_dependencies.append(f"{dependency}: {e}")
The Web app (under which I will run the web job) also has python code using pandas, and it does not throw any error.
I have tried uploading pandas and numpy folder inside the zip file (creating venv, installing packages and zipping Lib/site-packages content), (for 32 bit and 64 bit python) as well as tried appending 'D:/home/site/wwwroot/my_app_name/env/Lib/site-packages' to sys.path.
I am not facing such issues in importing standard python modules or additional package modules like requests.
Error is also thrown in trying to import numpy.
So, I am assuming some kind of version mismatch is happening somewhere.
Any pointers to solve this will be really useful.
I have been using Python 3.x, not sure if I should try Python 2.x (virtual env, install package and zip content of Lib/site-packages).
Regards
Kunal
The key to solving the problem is to add Python 3.6.4 x64 Extension on the portal.
Steps:
Add Extensions on portal.
Create a requirements.txt file.
pandas==1.1.4
numpy==1.19.3
Create run.cmd.
Create below file and zip them into a single zip.
Upload the zip for the webjob.
For more details, please read this post.
Webjobs Running Error (3587fd: ERR ) from zipfile

install a python package for w python utility offline

I don't know python but I need to install a python utility. when running it using python ./main.py I am getting a message "No module named web" I downloaded the web.py .
My question is how to install it and where to put the webpy-master directory (that was downloaded when searching for the web.py ) or the web dir under it and what exactly to do
Note that I am running in an environment without web access so I can't just do pip install
and my python version is 2.7 (this is what the utility needs)
I saw this answer
Python Packages Offline Installation
but since I don't know python and i can't download other things ( it's complicated , need to go to security department etc ) also I don't understand how to use environment.txt
please don't set it as duplicate.
I put the Web directory where the main.py is and added
import web
to the main.py and it worked ! thank you !

Which platform to use when importing Python Packages into the Azure Automation engine

I have a Python script that I want to run in the Azure Automation engine. It imports a few packages, one of which is lxml. There are a lot of platform variations available from the Python Package Index and I can't find any documentation from Azure about which platform I should be using.
Choosing the wrong version provides the following error through the Azure portal:
Orchestrator.Activities.PythonPackageExtractException: Error while extractinig Python package: Unexpected file structure in .whl file for python package lxml. It is likely that the package is for an unsupported platform.
at Orchestrator.Activities.SetModuleActivity.ExecuteInternal(CodeActivityContext context, Byte[] moduleContent, String moduleName, ModuleLanguage moduleLanguage, Guid moduleVersionId, String modulePath)
at Orchestrator.Activities.SetModuleActivity.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
It seems I'm not the only one who's had trouble figuring out which version / platform to use for setting up lxml. Based on this Stack Overflow question, I tried running the following in the Automation environment:
import platform
print(platform.architecture())
This gave me the result ('64bit', 'WindowsPE'), which was enough to guess that I needed the library with win_amd64.whl as the postfix. Sure enough, that worked.
So, if you're importing libraries into the Azure Automation engine, make sure they're tagged as cp27 and made for the win_amd64 platform.

cx_Freeze. How install service and execute script after install

I wrote lets scripts for customer. In order not to install python and dependent packages, I packed all to 3 exe-file using cx-freeze. First - winservice, who does most of the work. Second - settings wizard. Third - client for work with winservice. Faced to the task, need after installing the package (made using bdist_msi) register the service in system, and run the wizard. How do it?
I think if you don't have a certificate that's impossible.

Google App Engine library imports

I've been experimenting with the Google App Engine, and I'm trying to import certain libraries in order to execute API commands. I've been having trouble importing, however. When I tried to execute "from apiclient.discovery import build", my website doesn't load anymore. When I test locally in IDLE, this command works.
the python api-client package comes with a command enable-app-engine-project that will install all of the required packages into your project folder:
http://code.google.com/p/google-api-python-client/wiki/GoogleAppEngine
The packages needs to be locally available, where did you put the packages, in the Python folder or in your project folder?

Categories

Resources