question

MF-9862 avatar image
0 Votes"
MF-9862 asked MF-9862 commented

Unable to import python packages "azure-identity","psycopg2" and "sh" in Azure Automation (python 3)


Hi, I'm trying to import these two packages in Azure Automation python3.

https://pypi.org/project/psycopg2/#files
https://pypi.org/project/sh/#files

I have downloaded tar.gz files and added to "Python Packages" however I get this error message:

Runtime version
3.8.0
Error
Orchestrator.Activities.PythonPackageExtractException: Error while extractinig Python package: pip could not convert tar.gz file C:\Users\Client\Temp\psycopg2.tar.gz to wheel file Processing c:\users\client\temp\psycopg2.tar.gz ERROR: Command errored out with exit status 1: command: 'C:\WPy64-3800\python-3.8.0.amd64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Client\\Temp\\pip-req-build-m8folar4\\setup.py'"'"'; ....

Error
Orchestrator.Activities.PythonPackageExtractException: Error while extractinig Python package: pip could not convert tar.gz file C:\Users\Client\Temp\sh.tar.gz to wheel file Processing c:\users\client\temp\sh.tar.gz ERROR: Command errored out with exit status 1: command: 'C:\WPy64-3800\python-3.8.0.amd64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Client\\Temp\\pip-req-build-xu8allvp\\setup.py'"'.....

How can I import these packages?

Looking forward to hearing from you.

azure-automation
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered MF-9862 commented

Hi @MF-9862,

I was also able to reproduce the issue and has received the same error. However as mentioned here, the Azure Sandbox environment might not have the required compilers for C/C++ binaries so it's recommended to use wheel files. Hence, I have used the wheel files that are highlighted in the below screenshot and was able to successfully import the packages.

187864-image.png

187709-image.png

187805-image.png


image.png (80.6 KiB)
image.png (47.0 KiB)
image.png (45.2 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MF-9862,

I was able to successfully import the msal package using this wheel file. If you have earlier not tried using this wheel file then try using it and see if it works for you. If you have earlier tried using the same wheel file please confirm it.

189501-image.png

189502-image.png


1 Vote 1 ·
image.png (78.6 KiB)
MF-9862 avatar image MF-9862 tbgangav-MSFT ·

Hi,
Thanks for the reply.
I have tried with the same file that you mentioned with Runtime version: 3.8.0 it failed last time, but tried it now and it worked fine. thanks.

1 Vote 1 ·